Skip to content

Commit

Permalink
Merge 861f84e into 02c7032
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminoakes committed Oct 15, 2013
2 parents 02c7032 + 861f84e commit 94f4052
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ Custom Jobs
Jobs are simple ruby objects with a method called perform. Any object which responds to perform can be stuffed into the jobs table. Job objects are serialized to yaml so that they can later be resurrected by the job runner.

```ruby
class NewsletterJob < Struct.new(:text, :emails)
NewsletterJob = Struct.new(:text, :emails) do
def perform
emails.each { |e| NewsletterMailer.deliver_text_to_email(text, e) }
end
Expand All @@ -238,7 +238,7 @@ Delayed::Job.enqueue NewsletterJob.new('lorem ipsum...', Customers.find(:all).co
```
To set a per-job max attempts that overrides the Delayed::Worker.max_attempts you can define a max_attempts method on the job
```ruby
class NewsletterJob < Struct.new(:text, :emails)
NewsletterJob = Struct.new(:text, :emails) do
def perform
emails.each { |e| NewsletterMailer.deliver_text_to_email(text, e) }
end
Expand Down

0 comments on commit 94f4052

Please sign in to comment.