I\'m trying to do a conditional render of a different template from ActionMailer (Rails 3.1.1). I want most users to get the normal welcome.html.erb
template, but s
You shouldn't try to do anything after you call mail()
. However, to choose another template, you should pass :template_name
as an option. For example:
template = @user.is_photographer ? "welcome_photographer" : "welcome"
mail(:to => "#{@user.name} <#{@user.email}>",
:subject => "Welcome to ...",
:template_name => template)