Recall & Review
beginner
What command do you use to generate a new mailer in Rails?
You use
rails generate mailer MailerName to create a new mailer with default files.Click to reveal answer
beginner
Where do Rails mailer templates live?
Mailer templates are stored in
app/views/mailer_name/ folder, with one file per email action.Click to reveal answer
intermediate
How do you define an email method inside a Rails mailer?
Inside the mailer class, define a method that sets instance variables and calls
mail(to:, subject:) to send the email.Click to reveal answer
beginner
What file extension do Rails mailer templates use for HTML emails?
Rails uses
.html.erb files for HTML email templates, combining HTML with embedded Ruby.Click to reveal answer
intermediate
How can you preview emails in Rails during development?
You can preview emails by creating a preview class in <code>test/mailers/previews</code> and visiting <code>http://localhost:3000/rails/mailers</code>.Click to reveal answer
Which command generates a mailer named 'UserMailer' in Rails?
✗ Incorrect
The correct command to generate a mailer is
rails generate mailer UserMailer.Where do you place the email template files for a mailer called 'NotificationMailer'?
✗ Incorrect
Email templates go inside
app/views/notification_mailer/ folder.What method do you call inside a mailer method to send an email?
✗ Incorrect
Inside a mailer method, you call
mail(to:, subject:) to prepare the email.Which file extension is used for plain text email templates in Rails?
✗ Incorrect
Plain text email templates use
.txt.erb extension.How can you preview emails in Rails without sending them?
✗ Incorrect
You can preview emails by visiting
http://localhost:3000/rails/mailers in development.Explain the steps to create and send an email using a Rails mailer.
Think about generating, coding the method, templates, and sending.
You got /6 concepts.
Describe how Rails mailer templates work and where they are stored.
Focus on folder location, file types, and how templates use Ruby.
You got /5 concepts.