Search code examples
ruby-on-railsruby-on-rails-3devisemailer

How do I configure devise to use a custom email layout?


When I say layout I don't mean just simply the views, I generate those. On all my own mailers I'm using a default layout. Which I define in the SomeMailer.rb file

#some_mailer.rb
class SomeMailer < ActionMailer::Base
  layout 'sometemplate'

Is there some way I can do this for the Devise Mailer et al.?


Solution

  • Found the answer sitting in the Devise Github wiki,

    Reading that helps. ;-)

    config.to_prepare do
      Devise::Mailer.layout "simple" # simple.haml or simple.erb
      Devise::Mailer.helper :mailer
    end
    

    Here is the reference of the wiki page: How To: Create custom layouts