Permalink
Browse files

Updating the documentation to ActionMailer::Base.queue

  • Loading branch information...
1 parent d0c25f2 commit a25b5f683d6d7c1a9678227c2e067bcf3882bc2c @rafaelfranca rafaelfranca committed Sep 12, 2012
@@ -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!
@@ -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>.
@@ -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:

0 comments on commit a25b5f6

Please sign in to comment.