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 some users to get the special welcome_photographer.html.erb
template. This type of thing works in ActionController:
# (in /app/mailers/user_mailer.rb)
def welcome(user)
@user = user
mail(:to => "#{@user.name} <#{@user.email}>", :subject => "Welcome to ...")
render "welcome_photographer" if @user.is_photographer
end
But the render doesn't work -- everyone gets the standard welcome.html.erb
even if @user.is_photographer == true