README.md in resque_mailer-2.2.6 vs README.md in resque_mailer-2.2.7
- old
+ new
@@ -28,11 +28,11 @@
include Resque::Mailer
end
Now, when `MyMailer.subject_email(params).deliver` is called, an entry
will be created in the job queue. Your Resque workers will be able to deliver
-this message for you. The queue we're using is imaginatively named +mailer+,
+this message for you. The queue we're using is imaginatively named `mailer`,
so just make sure your workers know about it and are loading your environment:
QUEUE=mailer rake environment resque:work
Note that you can still have mail delivered synchronously by using the bang
@@ -57,14 +57,13 @@
name when starting your workers.
QUEUE=application_specific_mailer rake environment resque:work
Custom handling of errors that arise when sending a message is possible by
-assigning a lambda to the `error_hander` attribute.
+assigning a lambda to the `error_hander` attribute. There are two supported
+lambdas for backwards compatiability.
-There are two supported lambdas for backwards compatiability:
-
The first lamba will be deprecated in a future release:
```ruby
Resque::Mailer.error_handler = lambda { |mailer, message, error|
# some custom error handling code here in which you optionally re-raise the error
@@ -75,14 +74,14 @@
mailers to be requeued on failure:
```ruby
Resque::Mailer.error_handler = lambda { |mailer, message, error, action, args|
# Necessary to re-enqueue jobs that receieve the SIGTERM signal
- if exception.is_a?(Resque::TermException)
+ if error.is_a?(Resque::TermException)
Resque.enqueue(mailer, action, *args)
else
- raise exception
+ raise error
end
}
```
### Resque::Mailer as a Project Default
@@ -96,22 +95,22 @@
include Resque::Mailer
end
# app/mailers/example_mailer.rb
class ExampleMailer < AsyncMailer
- def say_hello(user)
+ def say_hello(user_id)
# ...
end
end
### Using with Resque Scheduler
If [resque-scheduler](https://github.com/bvandenbos/resque-scheduler) is
installed, two extra methods will be available: `deliver_at` and `deliver_in`.
These will enqueue mail for delivery at a specified time in the future.
- # Delivers on the 25th of December, 2013
- MyMailer.reminder_email(params).deliver_at(Time.parse('2013-12-25'))
+ # Delivers on the 25th of December, 2014
+ MyMailer.reminder_email(params).deliver_at(Time.parse('2014-12-25'))
# Delivers in 7 days
MyMailer.reminder_email(params).deliver_in(7.days)
# Unschedule delivery