Home
Ruby on Rails
Cheatsheets
Once a mailer action and template are defined, you can deliver your message or create and save it for delivery later by calling the mailer class and prefixing your chosen class method with deliver_ or create_
Notifier.deliver_signup_notification(customer)
mail = Notifier.create_signup_notification(customer) Notifier.deliver(mail)
You can pass the mailer model any variables you need to use in the generation of the email. In the example above we have passed it a variable named customer which could be an instance of an ActiveRecord Customer model. We can then access our customer's details in the mailer model.