Rails pass request.subdomain into a custom Devise mailer layout
问题 I need to adapt the forgot password instructions to handle a subdomain. I have followed the instructions on the devise site to override the mailer, controller and add a subdomain helper etc. as listed: controllers/password_controller.rb class PasswordsController < Devise::PasswordsController def create @subdomain = request.subdomain super end end routes.rb devise_for :users, controllers: { passwords: 'passwords' } devise.rb config.mailer = "UserMailer" mailers/user_mailer.rb class UserMailer