From 08b07b60b6d91a2f7bba5eec1e9b1d26599c578a Mon Sep 17 00:00:00 2001 From: Mikel Lindsaar Date: Sun, 2 May 2010 11:30:10 +1000 Subject: Adding ability to pass proc's to the ActionMailer class default method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- actionmailer/lib/action_mailer/base.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'actionmailer/lib/action_mailer') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index e566132f4e..3a49da5984 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -528,8 +528,13 @@ module ActionMailer #:nodoc: content_type = headers[:content_type] parts_order = headers[:parts_order] + # Call all the procs (if any) + default_values = self.class.default.merge(self.class.default) do |k,v| + v.respond_to?(:call) ? v.call : v + end + # Handle defaults - headers = headers.reverse_merge(self.class.default) + headers = headers.reverse_merge(default_values) headers[:subject] ||= default_i18n_subject # Apply charset at the beginning so all fields are properly quoted -- cgit v1.2.3