Ruby/Rails: How do you customize the mailer templates of Devise?

后端 未结 6 892
Happy的楠姐
Happy的楠姐 2020-12-08 03:45

I\'ve installed Devise for my Rails app (3.0.1) and it\'s mostly working. I just can\'t seem customize the mailer views.

  • My user model is \"User\".
6条回答
  •  旧巷少年郎
    2020-12-08 04:48

    I think you'll need to manage the Devise views yourself. Try the following in a console:

    rails generate devise:views
    

    This will generate all the views Devise uses (including mailer templates), which you can now customize.

    The mailers you're looking for should then be in 'app/views/devise/mailer'

    If you want to generate scoped views, or only a subset of them that is also possible. Per the documentation at https://github.com/plataformatec/devise#configuring-views:

    You can also use the generator to generate scoped views:

    rails generate devise:views users
    

    If you would like to generate only a few sets of views, like the ones for the registerable and confirmable module, you can pass a list of modules to the generator with the -v flag.

    rails generate devise:views -v registrations confirmations
    

提交回复
热议问题