I want to modify the send_reset_password_instructions
method so that I can send some extra parameters through it to the url. Then I can read that parameter in the url and if its present I will style the view (and the mailer) in a different way.
What I really need to do is send the reset password instead of confirmation email. I have already made my app send the reset password instead of confirmation but now I need to edit the mailer and the view to be different. How can I do this?
OK so your question has 2 parts.
Overriding the send_reset_password_instructions
method:
- Visit the Devise Github page and find where the method is defined.
- Create a file with the same name and relative path in you own app folder. Eg.: Devise has this helper
app/mailers/devise/mailer.rb
, if you want to override it you create the same in you own app
directory.
- Copy the method and override as needed. Devise will automatically pickup the files.
Editing the views / mailers: You just need to run this command:
rails generate devise:views
You will have the mailer views in you views folder.
Hope this helps :)