Ruby on Rails

ActionMailer

Sending emails, mailers, layouts, attachments, delivery methods, testing emails

18 câu hỏi phỏng vấn·
Mid-Level
1

Which command generates a new mailer in a Rails application?

Câu trả lời

The rails generate mailer command (or rails g mailer) creates a new mailer with the corresponding class in app/mailers, views in app/views, and test files. This command follows Rails conventions and automatically generates the file structure needed to send emails.

2

Which class must all mailers inherit from in a Rails application?

Câu trả lời

All Rails mailers inherit from ApplicationMailer, which itself inherits from ActionMailer::Base. ApplicationMailer is created by default in app/mailers and allows defining common configurations for all mailers in the application, such as the default layout or sender address.

3

In which directory are email view templates located in a Rails application?

Câu trả lời

Email view templates are located in app/views/mailer_name/. Each mailer method corresponds to a template (for example welcome_email.html.erb and welcome_email.text.erb). Rails automatically looks for templates matching the mailer method name.

4

Which method should be used to send an email asynchronously via ActiveJob?

5

How to define the default sender address for all emails in a mailer?

+15 câu hỏi phỏng vấn

Nắm vững Ruby on Rails cho lần phỏng vấn tiếp theo

Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.

Bắt đầu miễn phí