Rename reminder mailer
This commit is contained in:
parent
4d48e482fe
commit
6462a62060
|
@ -4,7 +4,7 @@ class RemindersController < ApplicationController
|
|||
def create
|
||||
@reminder = Reminder.new(params[:reminder])
|
||||
if @reminder.save
|
||||
ThingMailer.reminder_email(@reminder.thing).deliver
|
||||
ThingMailer.reminder(@reminder.thing).deliver
|
||||
@reminder.update_attribute(:sent, true)
|
||||
render(:json => @reminder)
|
||||
else
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
class ThingMailer < ActionMailer::Base
|
||||
default :from => "hello@#{default_url_options[:host]}"
|
||||
default :from => "adoptahydrant@cityofboston.gov"
|
||||
|
||||
def reminder_email(thing)
|
||||
def reminder(thing)
|
||||
@thing = thing
|
||||
@user = thing.user
|
||||
mail({
|
||||
:to => thing.user.email,
|
||||
:from => "reminder@#{default_url_options[:host]}",
|
||||
:subject => ["Remember to Shovel", thing.name].compact.join(' '),
|
||||
})
|
||||
mail(
|
||||
{
|
||||
:to => thing.user.email,
|
||||
:subject => ["Remember to shovel", thing.name].compact.join(' '),
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
Hello <%= @user.name.split.first %>,
|
||||
|
||||
Did you remember to shovel out the fire hydrant you adopted at <%= @thing.street_address %>? If not, please shovel your hydrant as soon as possible!
|
||||
|
||||
If you've already shoveled, thank you for serving your city!
|
||||
|
||||
The Boston Fire Department
|
|
@ -1,7 +0,0 @@
|
|||
Hello <%= @thing.user.name.split.first %>,
|
||||
|
||||
Did you remember to shovel <%= ['out', @thing.name, 'the'].compact.join(' ') %> fire hydrant you adopted at <%= @thing.street_address %>? If not, please shovel your hydrant as soon as possible!
|
||||
|
||||
If you've already shoveled, thank you for serving your city!
|
||||
|
||||
Boston Fire Department
|
|
@ -16,6 +16,6 @@ class RemindersControllerTest < ActionController::TestCase
|
|||
assert_response :success
|
||||
email = ActionMailer::Base.deliveries.last
|
||||
assert_equal [@dan.email], email.to
|
||||
assert_equal "Remember to Shovel", email.subject
|
||||
assert_equal "Remember to shovel", email.subject
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue