Module: ActionMailer::DeprecatedApi
- Extended by:
- ActiveSupport::Concern
- Included in:
- Base
- Defined in:
- lib/action_mailer/deprecated_api.rb
Overview
This is the API which is deprecated and is going to be removed on Rails 3.1 release. Part of the old API will be deprecated after 3.1, for a smoother deprecation process. Check those in OldApi instead.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#deliver!(mail = @_message) ⇒ Object
(also: #deliver)
Delivers a Mail object.
- #render(*args) ⇒ Object
-
#render_message(*args) ⇒ Object
Render a message but does not set it as mail body.
Instance Method Details
#deliver!(mail = @_message) ⇒ Object Also known as: deliver
Delivers a Mail object. By default, it delivers the cached mail object (from the create!
method). If no cached mail object exists, and no alternate has been given as the parameter, this will fail.
89 90 91 92 93 |
# File 'lib/action_mailer/deprecated_api.rb', line 89 def deliver!(mail = @_message) ActiveSupport::Deprecation.warn "Calling deliver in the AM::Base object is deprecated, " << "please call deliver in the Mail instance", caller[0,2] self.class.deliver(mail, false) end |
#render(*args) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/action_mailer/deprecated_api.rb', line 96 def render(*args) = args.last.is_a?(Hash) ? args.last : {} if file = [:file] and !file.index("/") ActiveSupport::Deprecation.warn("render :file is deprecated except for absolute paths. " \ "Please use render :template instead") [:prefix] = _prefix end if [:body].is_a?(Hash) ActiveSupport::Deprecation.warn(':body in render deprecated. Please use instance ' << 'variables as assigns instead', caller[0,1]) [:body].each { |k,v| instance_variable_set(:"@#{k}", v) } end super end |
#render_message(*args) ⇒ Object
Render a message but does not set it as mail body. Useful for rendering data for part and attachments.
Examples:
"special_message"
:template => "special_message"
:inline => "<%= 'Hi!' %>"
123 124 125 126 |
# File 'lib/action_mailer/deprecated_api.rb', line 123 def (*args) ActiveSupport::Deprecation.warn "render_message is deprecated, use render instead", caller[0,2] render(*args) end |