Ruby on Rails

ActionMailer

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

18 mülakat soruları·
Mid-Level
1

Which command generates a new mailer in a Rails application?

Cevap

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?

Cevap

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?

Cevap

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 mülakat soruları

Bir sonraki mülakatın için Ruby on Rails'de uzmanlaş

Tüm sorulara, flashcards'a, teknik testlere, code review alıştırmalarına ve mülakat simülatörlerine eriş.

Ücretsiz başla