From 1cec84ad2ddd843484ed40b1eb7492063ce71baf Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 28 Jan 2017 11:20:46 +0100 Subject: Offer the option to use parameterization for shared processing of headers and ivars (#27825) Offer the option to use parameterization for shared processing of headers and ivars --- actionmailer/test/mailers/params_mailer.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 actionmailer/test/mailers/params_mailer.rb (limited to 'actionmailer/test/mailers') diff --git a/actionmailer/test/mailers/params_mailer.rb b/actionmailer/test/mailers/params_mailer.rb new file mode 100644 index 0000000000..4c0fae6d91 --- /dev/null +++ b/actionmailer/test/mailers/params_mailer.rb @@ -0,0 +1,11 @@ +class ParamsMailer < ActionMailer::Base + before_action { @inviter, @invitee = params[:inviter], params[:invitee] } + + default to: Proc.new { @invitee }, from: -> { @inviter } + + def invitation + mail(subject: "Welcome to the project!") do |format| + format.text { render plain: "So says #{@inviter}" } + end + end +end -- cgit v1.2.3