In the past couple days, I have been trying to deploy a site that involves using Action Mailer which allow you to send automatic email notifications to users who click on your page (in areas such as “register”, etc).
I have been following the Rails Guides for it but I couldn’t seem to make it work and after fighting with my code I was finally able to fix a bug and make it work and here are my notes (cheatsheet) for anyone who may find to be stuck trying to follow the rails guide or other tutorials:
What was the problem?
After the user was clicking, I was able to send an automatic email so the mailer main goal was done but I wasn’t able to send them to the next page and instead I was getting the following error:
How did I fix this?
Well, seems like the exact layout of the code has changed a bit through different rails version and with the rails 3.2 we need to include a respond_to do |format| …end code in which we will place the Mailer code(code provided by the Rails Guide). Therefore, the fix code should be the following in the user controller file:
Lesson Learn: Watch out for new changes depending on the version so whatever the rails guide or other trust worthy materials say may not work because of it.