mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #16587 from seuros/master
[Rdoc] Make clear that we are sending an AR object [ci skip]
This commit is contained in:
commit
f39aaa4c82
2 changed files with 16 additions and 16 deletions
|
@ -138,20 +138,20 @@ module ActionMailer
|
||||||
# Once a mailer action and template are defined, you can deliver your message or create it and save it
|
# Once a mailer action and template are defined, you can deliver your message or create it and save it
|
||||||
# for delivery later:
|
# for delivery later:
|
||||||
#
|
#
|
||||||
# Notifier.welcome('david').deliver_now # sends the email
|
# Notifier.welcome(User.first).deliver_now # sends the email
|
||||||
# mail = Notifier.welcome('david') # => an ActionMailer::MessageDeliver object
|
# mail = Notifier.welcome(User.first) # => an ActionMailer::MessageDeliver object
|
||||||
# mail.deliver_now # sends the email
|
# mail.deliver_now # sends the email
|
||||||
#
|
#
|
||||||
# The <tt>ActionMailer::MessageDeliver</tt> class is a wrapper around a <tt>Mail::Message</tt> object. If
|
# The <tt>ActionMailer::MessageDeliver</tt> class is a wrapper around a <tt>Mail::Message</tt> object. If
|
||||||
# you want direct access to the <tt>Mail::Message</tt> object you can call the <tt>message</tt> method on
|
# you want direct access to the <tt>Mail::Message</tt> object you can call the <tt>message</tt> method on
|
||||||
# the <tt>ActionMailer::MessageDeliver</tt> object.
|
# the <tt>ActionMailer::MessageDeliver</tt> object.
|
||||||
#
|
#
|
||||||
# Notifier.welcome('david').message # => a Mail::Message object
|
# Notifier.welcome(User.first).message # => a Mail::Message object
|
||||||
#
|
#
|
||||||
# ActionMailer is nicely integrated with ActiveJob so you can send emails in the background (example: outside
|
# ActionMailer is nicely integrated with ActiveJob so you can send emails in the background (example: outside
|
||||||
# of the request-response cycle, so the user doesn't have to wait on it):
|
# of the request-response cycle, so the user doesn't have to wait on it):
|
||||||
#
|
#
|
||||||
# Notifier.welcome('david').deliver_later # enqueue the email sending to ActiveJob
|
# Notifier.welcome(User.first).deliver_later # enqueue the email sending to ActiveJob
|
||||||
#
|
#
|
||||||
# You never instantiate your mailer class. Rather, you just call the method you defined on the class itself.
|
# You never instantiate your mailer class. Rather, you just call the method you defined on the class itself.
|
||||||
#
|
#
|
||||||
|
|
|
@ -7,10 +7,10 @@ module ActionMailer
|
||||||
# around a lazy created Mail::Message. You can get direct access to the
|
# around a lazy created Mail::Message. You can get direct access to the
|
||||||
# Mail::Message, deliver the email or schedule the email to be sent through ActiveJob.
|
# Mail::Message, deliver the email or schedule the email to be sent through ActiveJob.
|
||||||
#
|
#
|
||||||
# Notifier.welcome('david') # an ActionMailer::MessageDeliver object
|
# Notifier.welcome(User.first) # an ActionMailer::MessageDeliver object
|
||||||
# Notifier.welcome('david').deliver_now # sends the email
|
# Notifier.welcome(User.first).deliver_now # sends the email
|
||||||
# Notifier.welcome('david').deliver_later # enqueue the deliver email job to ActiveJob
|
# Notifier.welcome(User.first).deliver_later # enqueue the deliver email job to ActiveJob
|
||||||
# Notifier.welcome('david').message # a Mail::Message object
|
# Notifier.welcome(User.first).message # a Mail::Message object
|
||||||
class MessageDelivery < Delegator
|
class MessageDelivery < Delegator
|
||||||
def initialize(mailer, mail_method, *args) #:nodoc:
|
def initialize(mailer, mail_method, *args) #:nodoc:
|
||||||
@mailer = mailer
|
@mailer = mailer
|
||||||
|
@ -38,9 +38,9 @@ module ActionMailer
|
||||||
#
|
#
|
||||||
# ==== Examples
|
# ==== Examples
|
||||||
#
|
#
|
||||||
# Notifier.welcome('david').deliver_later
|
# Notifier.welcome(User.first).deliver_later
|
||||||
# Notifier.welcome('david').deliver_later(in: 1.hour)
|
# Notifier.welcome(User.first).deliver_later(in: 1.hour)
|
||||||
# Notifier.welcome('david').deliver_later(at: 10.hours.from_now)
|
# Notifier.welcome(User.first).deliver_later(at: 10.hours.from_now)
|
||||||
#
|
#
|
||||||
# ==== Options
|
# ==== Options
|
||||||
# * <tt>in</tt> - Enqueue the message to be delivered with a delay
|
# * <tt>in</tt> - Enqueue the message to be delivered with a delay
|
||||||
|
@ -54,9 +54,9 @@ module ActionMailer
|
||||||
#
|
#
|
||||||
# ==== Examples
|
# ==== Examples
|
||||||
#
|
#
|
||||||
# Notifier.welcome('david').deliver_later
|
# Notifier.welcome(User.first).deliver_later
|
||||||
# Notifier.welcome('david').deliver_later(in: 1.hour)
|
# Notifier.welcome(User.first).deliver_later(in: 1.hour)
|
||||||
# Notifier.welcome('david').deliver_later(at: 10.hours.from_now)
|
# Notifier.welcome(User.first).deliver_later(at: 10.hours.from_now)
|
||||||
#
|
#
|
||||||
# ==== Options
|
# ==== Options
|
||||||
# * <tt>in</tt> - Enqueue the message to be delivered with a delay
|
# * <tt>in</tt> - Enqueue the message to be delivered with a delay
|
||||||
|
@ -68,7 +68,7 @@ module ActionMailer
|
||||||
# Delivers a message. The message will be sent bypassing checking perform_deliveries
|
# Delivers a message. The message will be sent bypassing checking perform_deliveries
|
||||||
# and raise_delivery_errors, so use with caution.
|
# and raise_delivery_errors, so use with caution.
|
||||||
#
|
#
|
||||||
# Notifier.welcome('david').deliver_now!
|
# Notifier.welcome(User.first).deliver_now!
|
||||||
#
|
#
|
||||||
def deliver_now!
|
def deliver_now!
|
||||||
message.deliver!
|
message.deliver!
|
||||||
|
@ -76,7 +76,7 @@ module ActionMailer
|
||||||
|
|
||||||
# Delivers a message:
|
# Delivers a message:
|
||||||
#
|
#
|
||||||
# Notifier.welcome('david').deliver_now
|
# Notifier.welcome(User.first).deliver_now
|
||||||
#
|
#
|
||||||
def deliver_now
|
def deliver_now
|
||||||
message.deliver
|
message.deliver
|
||||||
|
|
Loading…
Reference in a new issue