Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@advorak
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save advorak/8bb60de5071d9756e167 to your computer and use it in GitHub Desktop.
Save advorak/8bb60de5071d9756e167 to your computer and use it in GitHub Desktop.
class Person < ActiveRecord::Base
include Backburner::Performable
queue_priority 500
def self.make_person(name, options = {})
self.create name: name, guid: options[:guid]
end
def self.work
Backburner.work('person-jobs','backburner-jobs','person')
end
end
# I am running a separate task in the console by running: Person.work
# When I make a person, the guid field gets transmitted...
Person.make_person 'Andy', guid: '12345'
Person.last #=> #<Person id: 6, name: "Andy", guid: "12345", created_at: "2014-08-27 09:26:15", updated_at: "2014-08-27 09:26:15">
# PROBLEM: When I use Person.async, the guid field is not transmitted -- only the first item...
Person.async.make_person('Andy', {guid: 'test'})
Person.last #=> #<Person id: 8, name: "Andy", guid: nil, created_at: "2014-08-27 09:31:37", updated_at: "2014-08-27 09:31:37">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment