After getting :confirmable working for the Rails Devise gem, I wanted to create a welcome email that would tell the user that they successfully confirmed their account and welcoming them to the site.
Here are the steps I took:
- Create the email views and placed them in my mailer directory
- I use User.rb as my model, so I created an observer to watch changes to the models. In that app/models/user_observer.rb, I put this code:
# Send Welcome Mail after confirmation
This watches for the change in confirmed_at, then sends my email (welcome_mail).
3. In application.rb, added this:
config.active_record.observers = :user_observer