
ActionMailer
Sending emails, mailers, layouts, attachments, delivery methods, testing emails
1Which command generates a new mailer in a Rails application?
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.
2Which class must all mailers inherit from in a Rails application?
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.
3In which directory are email view templates located in a Rails application?
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.
Which method should be used to send an email asynchronously via ActiveJob?
How to define the default sender address for all emails in a mailer?
+15 câu hỏi phỏng vấn
Các chủ đề phỏng vấn Ruby on Rails khác
Ruby Basics
Ruby Object-Oriented Programming
Rails Fundamentals
Routing & Controllers
ActiveRecord Basics
Views & ERB Templates
ActiveRecord Associations
Advanced ActiveRecord Queries
Rails Forms
Authentication & Authorization
Modern Asset Pipeline & Frontend
Rails API Mode
Testing with RSpec
ActiveJob & Background Jobs
ActionCable & WebSockets
ActiveStorage
Caching Strategies
Advanced Migrations
Rails Engines & Modular Apps
Performance Optimization
Rails Design Patterns
Ruby Metaprogramming
Rails Security
GraphQL with Rails
Deployment & Production
Monitoring & Logging
Rails Upgrade Strategies
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í