aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-09-12 15:50:46 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-09-12 15:50:46 -0300
commita25b5f683d6d7c1a9678227c2e067bcf3882bc2c (patch)
treec9952c1cf281722b63771d92b1b065817e8a94b5
parentd0c25f253f43acba6ce27a1d3116c16fa4d3b536 (diff)
downloadrails-a25b5f683d6d7c1a9678227c2e067bcf3882bc2c.tar.gz
rails-a25b5f683d6d7c1a9678227c2e067bcf3882bc2c.tar.bz2
rails-a25b5f683d6d7c1a9678227c2e067bcf3882bc2c.zip
Updating the documentation to ActionMailer::Base.queue
-rw-r--r--actionmailer/lib/action_mailer/base.rb3
-rw-r--r--guides/source/action_mailer_basics.textile12
-rw-r--r--guides/source/configuring.textile5
3 files changed, 16 insertions, 4 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 9cc00ca5a1..26787c9b5e 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -363,6 +363,9 @@ module ActionMailer #:nodoc:
# * <tt>deliveries</tt> - Keeps an array of all the emails sent out through the Action Mailer with
# <tt>delivery_method :test</tt>. Most useful for unit and functional testing.
#
+ # * <tt>queue</> - The queue that will be used to deliver the mail. The queue should expect a job that
+ # responds to <tt>run</tt>
+ #
class Base < AbstractController::Base
include DeliveryMethods
abstract!
diff --git a/guides/source/action_mailer_basics.textile b/guides/source/action_mailer_basics.textile
index 6d04a76088..d92d5c48fb 100644
--- a/guides/source/action_mailer_basics.textile
+++ b/guides/source/action_mailer_basics.textile
@@ -538,14 +538,18 @@ Rails provides a Synchronous Queue by default. If you want to use an Asynchronou
h4. Custom Queues
-If you need a different queue than <tt>Rails.queue</tt> for your mailer you can override <tt>ActionMailer::Base#queue</tt>:
+If you need a different queue than <tt>Rails.queue</tt> for your mailer you can use <tt>ActionMailer::Base.queue=</tt>:
<ruby>
class WelcomeMailer < ActionMailer::Base
- def queue
- MyQueue.new
- end
+ self.queue = MyQueue.new
end
</ruby>
+or adding to your <tt>config/environments/$RAILS_ENV.rb</tt>:
+
+<ruby>
+config.action_mailer.queue = MyQueue.new
+</ruby>
+
Your custom queue should expect a job that responds to <tt>#run</tt>.
diff --git a/guides/source/configuring.textile b/guides/source/configuring.textile
index dd84754b22..73d6102eac 100644
--- a/guides/source/configuring.textile
+++ b/guides/source/configuring.textile
@@ -434,6 +434,11 @@ config.action_mailer.observers = ["MailObserver"]
config.action_mailer.interceptors = ["MailInterceptor"]
</ruby>
+* +config.action_mailer.queue+ registers the queue that will be used to deliver the mail.
+<ruby>
+config.action_mailer.queue = SomeQueue.new
+</ruby>
+
h4. Configuring Active Support
There are a few configuration options available in Active Support: