diff options
author | Mikel Lindsaar <raasdnil@gmail.com> | 2010-01-27 00:21:22 +1100 |
---|---|---|
committer | Mikel Lindsaar <raasdnil@gmail.com> | 2010-01-27 00:21:22 +1100 |
commit | 1133757a95f5cee0044cca6f360f5d63df3bb583 (patch) | |
tree | 814e4cc19c9b5625f1cc2c19d1fd615453e8b87c /actionmailer/lib/action_mailer/deprecated_api.rb | |
parent | 21dcc20ed29053c8ffd4d3a5a68a40f6e225512b (diff) | |
parent | 8fabcb2eca03150b1c0c3dbc88dd13123f76894f (diff) | |
download | rails-1133757a95f5cee0044cca6f360f5d63df3bb583.tar.gz rails-1133757a95f5cee0044cca6f360f5d63df3bb583.tar.bz2 rails-1133757a95f5cee0044cca6f360f5d63df3bb583.zip |
Merge branch 'master' of github.com:mikel/rails
Conflicts:
actionmailer/lib/action_mailer/base.rb
Diffstat (limited to 'actionmailer/lib/action_mailer/deprecated_api.rb')
-rw-r--r-- | actionmailer/lib/action_mailer/deprecated_api.rb | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/actionmailer/lib/action_mailer/deprecated_api.rb b/actionmailer/lib/action_mailer/deprecated_api.rb index 0eb8d85676..61101c26a1 100644 --- a/actionmailer/lib/action_mailer/deprecated_api.rb +++ b/actionmailer/lib/action_mailer/deprecated_api.rb @@ -5,8 +5,25 @@ module ActionMailer module DeprecatedApi #:nodoc: extend ActiveSupport::Concern - module ClassMethods + included do + [:charset, :content_type, :mime_version, :implicit_parts_order].each do |method| + class_eval <<-FILE, __FILE__, __LINE__ + 1 + def self.default_#{method} + @@default_#{method} + end + + def self.default_#{method}=(value) + ActiveSupport::Deprecation.warn "ActionMailer::Base.default_#{method}=value is deprecated, " << + "use defaults :#{method} => value instead" + @@default_#{method} = value + end + + @@default_#{method} = nil + FILE + end + end + module ClassMethods # Deliver the given mail object directly. This can be used to deliver # a preconstructed mail object, like: # @@ -99,7 +116,15 @@ module ActionMailer end private - + + def initialize_defaults(*) + @charset ||= self.class.default_charset.try(:dup) + @content_type ||= self.class.default_content_type.try(:dup) + @implicit_parts_order ||= self.class.default_implicit_parts_order.try(:dup) + @mime_version ||= self.class.default_mime_version.try(:dup) + super + end + def create_parts if @body.is_a?(Hash) && !@body.empty? ActiveSupport::Deprecation.warn "Giving a hash to body is deprecated, please use instance variables instead", caller[0,2] |