Module: ActionMailer::DeprecatedApi::ClassMethods
- Defined in:
- lib/action_mailer/deprecated_api.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_symbol, *parameters) ⇒ Object
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/action_mailer/deprecated_api.rb', line 60
def method_missing(method_symbol, *parameters)
if match = matches_dynamic_method?(method_symbol)
case match[1]
when 'create'
ActiveSupport::Deprecation.warn "#{self}.create_#{match[2]} is deprecated, " <<
"use #{self}.#{match[2]} instead", caller[0,2]
new(match[2], *parameters).message
when 'deliver'
ActiveSupport::Deprecation.warn "#{self}.deliver_#{match[2]} is deprecated, " <<
"use #{self}.#{match[2]}.deliver instead", caller[0,2]
new(match[2], *parameters).message.deliver
else super
end
else
super
end
end
|
Instance Method Details
#deliver(mail, show_warning = true) ⇒ Object
Deliver the given mail object directly. This can be used to deliver a preconstructed mail object, like:
email = MyMailer.create_some_mail(parameters)
email. "frobnicate"
MyMailer.deliver(email)
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/action_mailer/deprecated_api.rb', line 35
def deliver(mail, show_warning=true)
if show_warning
ActiveSupport::Deprecation.warn "#{self}.deliver is deprecated, call " <<
"deliver in the mailer instance instead", caller[0,2]
end
raise "no mail object available for delivery!" unless mail
wrap_delivery_behavior(mail)
mail.deliver
mail
end
|
#respond_to?(method_symbol, include_private = false) ⇒ Boolean
56
57
58
|
# File 'lib/action_mailer/deprecated_api.rb', line 56
def respond_to?(method_symbol, include_private = false)
matches_dynamic_method?(method_symbol) || super
end
|
#template_root ⇒ Object
47
48
49
|
# File 'lib/action_mailer/deprecated_api.rb', line 47
def template_root
self.view_paths && self.view_paths.first
end
|
#template_root=(root) ⇒ Object
51
52
53
54
|
# File 'lib/action_mailer/deprecated_api.rb', line 51
def template_root=(root)
ActiveSupport::Deprecation.warn "template_root= is deprecated, use prepend_view_path instead", caller[0,2]
self.view_paths = ActionView::Base.process_view_paths(root)
end
|