Forum: Ruby on Rails Two layouts in one mailer

Posted by Alex Duck (Guest)
on 2012-05-18 00:45
(Received via mailing list)
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!
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.