Two layouts in one mailer

6 views
Skip to first unread message

Alex Duck

unread,
May 17, 2012, 6:44:03 PM5/17/12
to rubyonra...@googlegroups.com
Hi all,

I'm having problems figuring out how to know which mailer method is being invoked in the layout callback.

In my controller, I have code like this and its working great:

class Users::RegistrationsController < Devise::RegistrationsController
    layout :devise_or_application

    def devise_or_application
        ["edit", "update", "destroy"].include?(params[:action]) ? "application" : "devise"
    end
end

Now I need the same thing for my mailer, but params[:action] is not available in mailers. Is there another way to use different layout in one mailer, based on which mailer method is being called, like above?

Mailer in question is a custom Devise mailer (inheriting from default Devise mailer), so I can't really use different mailer, as Devise allows me to configure only one mailer to be used.

Thanks in advance!
Reply all
Reply to author
Forward
0 new messages