class JobMailer < ActionMailer::Base
default :from => "emailer@email.com"
def new_job_email_for_client
#
#
@url = "http://simplesite.com/users/login"
mail(:to => @???,
:subject => "You have created a new case on simplesite.")
end
end
I would like each user to receive an email each and every time he/she creates a "job." In other parts of the application, I can access @user and user.email and such, but in the m开发者_JAVA百科ailer I'm getting "undefined errors."
How can I access the current users email address in the mailer (taking into consideration that Devise is in control of Users)?
I'm not sure if this is a great way of doing it, but this is how I got it working:
def new_job_email_for_client(user_email)
@url = "http://simplesite.com/users/login"
mail(:to => user_email,
:subject => "You have created a new case.")
end
精彩评论