aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib/action_mailer/base.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionmailer/lib/action_mailer/base.rb')
-rw-r--r--actionmailer/lib/action_mailer/base.rb17
1 files changed, 15 insertions, 2 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 5be1beaedb..928fed4777 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -23,8 +23,7 @@ module ActionMailer #:nodoc:
# bcc ["bcc@example.com", "Order Watcher <watcher@example.com>"]
# from "system@example.com"
# subject "New account information"
- #
- # @account = recipient
+ # body :account => recipient
# end
# end
#
@@ -523,6 +522,20 @@ module ActionMailer #:nodoc:
private
+ # Allow you to set assigns for your template:
+ #
+ # body :greetings => "Hi"
+ #
+ # Will make @greetings available in the template to be rendered.
+ def body(object=nil)
+ super # Run deprecation hooks
+
+ if object.is_a?(Hash)
+ @assigns_set = true
+ object.each { |k, v| instance_variable_set(:"@#{k}", v) }
+ end
+ end
+
# Set up the default values for the various instance variables of this
# mailer. Subclasses may override this method to provide different
# defaults.