Assuming you already have Resque installed, to use it, you simply need to add this to your GemFile:
From there, similar to the previous examples, to use it simply add enqueue before you Action Mailer methods:
The version is set at 0.2.0, but I am not expecting too many changes. I will bump it to 1.0 as soon as I add a custom matcher for cleaner specs and get some additional outside feedback.
If you are using the previous Gist versions, here are the changes I made:
- No dependency on Active Support. This is probably not a big deal for most rails projects, but less dependencies is always a good thing.
- The object passed to Resque is now the mailer class instead of MailQueue. This makes specs a little cleaner to read since you are referencing the actual mailer.
- The queue the emails are placed in can now be changed per mailer.
- The module is now injected into ActionMailer::Base and available on all of your mailers.
This was my first real gem. So if you see anything odd in it, please let me know.