aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib/action_mailer/deprecated_body.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-01-19 15:34:58 +0100
committerJosé Valim <jose.valim@gmail.com>2010-01-19 15:34:58 +0100
commite10f51b6b7b6260824cc86085be49cae216cf06c (patch)
tree58fbb3c36679fe1145f033abb8641b8a3448bbcf /actionmailer/lib/action_mailer/deprecated_body.rb
parentf32e3aff5f1e63f00bb0c5a5b5a9bbdf278443f9 (diff)
downloadrails-e10f51b6b7b6260824cc86085be49cae216cf06c.tar.gz
rails-e10f51b6b7b6260824cc86085be49cae216cf06c.tar.bz2
rails-e10f51b6b7b6260824cc86085be49cae216cf06c.zip
Refactor delivery methods.
Diffstat (limited to 'actionmailer/lib/action_mailer/deprecated_body.rb')
-rw-r--r--actionmailer/lib/action_mailer/deprecated_body.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/actionmailer/lib/action_mailer/deprecated_body.rb b/actionmailer/lib/action_mailer/deprecated_body.rb
index 5379b33a54..c82610014f 100644
--- a/actionmailer/lib/action_mailer/deprecated_body.rb
+++ b/actionmailer/lib/action_mailer/deprecated_body.rb
@@ -1,6 +1,6 @@
module ActionMailer
# TODO Remove this module all together in a next release. Ensure that super
- # hooks and @assigns_set in ActionMailer::Base are removed as well.
+ # hooks in ActionMailer::Base are removed as well.
module DeprecatedBody
extend ActionMailer::AdvAttrAccessor
@@ -22,12 +22,14 @@ module ActionMailer
end
def create_parts
- if String === @body && !defined?(@assigns_set)
+ if String === @body
ActiveSupport::Deprecation.warn('body(String) is deprecated. To set the body with a text ' <<
'call render(:text => "body")', caller[0,10])
self.response_body = @body
- elsif self.response_body
- @body = self.response_body
+ elsif @body.is_a?(Hash) && !@body.empty?
+ ActiveSupport::Deprecation.warn('body(Hash) is deprecated. Use instance variables to define ' <<
+ 'assigns in your view', caller[0,10])
+ @body.each { |k, v| instance_variable_set(:"@#{k}", v) }
end
end