aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-07-20 13:20:54 +0200
committerJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-07-27 23:02:44 +0200
commitb9b2ed5348f62a9b7ab29db50dfdd29089cf32d4 (patch)
treee10c73e6be266b4cbe372f67ad84dfbd49053cb6
parentRewrote UserMailer#question_title (diff)
downloadrecruiting-webapp-b9b2ed5348f62a9b7ab29db50dfdd29089cf32d4.tar.gz
recruiting-webapp-b9b2ed5348f62a9b7ab29db50dfdd29089cf32d4.tar.bz2
recruiting-webapp-b9b2ed5348f62a9b7ab29db50dfdd29089cf32d4.zip
Set email title in UserMailer#common
-rw-r--r--app/models/user_mailer.rb28
1 files changed, 12 insertions, 16 deletions
diff --git a/app/models/user_mailer.rb b/app/models/user_mailer.rb
index 7379e5d..db60b86 100644
--- a/app/models/user_mailer.rb
+++ b/app/models/user_mailer.rb
@@ -1,9 +1,10 @@
class UserMailer < ActionMailer::Base
- def common(user)
+ def common(user, subject)
@recipients = user.email_address
@from = "no-reply@#{ ActionMailer::Base.default_url_options[:host] }"
@sent_on = Time.now
@headers = {}
+ @subject = subject
end
def question_title(answer)
@@ -11,35 +12,30 @@ class UserMailer < ActionMailer::Base
end
def forgot_password(user, key)
- common(user)
- @subject = "#{@app_name} -- forgotten password"
- @body = { :user => user, :key => key, :app_name => app_name }
+ common(user, "#{@app_name} -- forgotten password")
+ @body = { :user => user, :key => key, :app_name => app_name }
end
def new_question(user, question)
- common(user)
- @subject = "New question"
- @body = { :title=> question.title, :category => question.question_category,
+ common(user, "New question")
+ @body = { :title=> question.title, :category => question.question_category,
:id => question.id}
end
def new_answer(user, answer)
- common(user)
- @subject = "New answer"
- @body = { :question_title=> question_title(answer), :recruit_name =>
+ common(user, "New answer")
+ @body = { :question_title=> question_title(answer), :recruit_name =>
answer.owner.name, :id => answer.id}
end
def changed_answer(user, answer)
- common(user)
- @subject = "Changed answer"
- @body = { :question_title=> question_title(answer), :recruit_name =>
+ common(user, "Changed answer")
+ @body = { :question_title=> question_title(answer), :recruit_name =>
answer.owner.name, :id => answer.id}
end
def new_comment(user, comment)
- common(user)
- @subject = "New comment"
- @body = { :question_title=> question_title(comment.answer), :id => comment.answer.id }
+ common(user, "New comment")
+ @body = { :question_title=> question_title(comment.answer), :id => comment.answer.id }
end
end