Skip to content

Commit

Permalink
Rename reminder mailer
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Oct 10, 2011
1 parent 4d48e48 commit 6462a62
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/controllers/reminders_controller.rb
Expand Up @@ -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
Expand Down
15 changes: 8 additions & 7 deletions app/mailers/thing_mailer.rb
@@ -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
7 changes: 7 additions & 0 deletions app/views/thing_mailer/reminder.text.erb
@@ -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
7 changes: 0 additions & 7 deletions app/views/thing_mailer/reminder_email.text.erb

This file was deleted.

2 changes: 1 addition & 1 deletion test/functional/reminders_controller_test.rb
Expand Up @@ -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

0 comments on commit 6462a62

Please sign in to comment.