I have project_mailer with layout but I want to use different method if the project_notification method has parameter that unsubscribe_link = true
.
layout "project_mail"
def project_notification(user, projects, unsubsribe_link = false)
attachments.inline['logo_252.png'] = File.read(Rails.root + 'public/images/logo_252.png')
@user = user
@projects = projects
mail(:to => user.email, :subject => "New Projects")
end
I asume you already solved your question, I answer to help others:
layout 'project_mail'
def project_notification(user, projects, unsubscribe_link = false)
attachments.inline['logo_252.png'] = File.read(Rails.root + 'public/images/logo_252.png')
@user = user
@projects = projects
layout_name = unsubscribe_link ? 'other_fancy_layout' : 'project_mail'
mail(to: user.email, subject: "New Projects") do |format|
format.html { render layout: layout_name }
format.text { render layout: layout_name }
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With