Skip to content

Instantly share code, notes, and snippets.

@advorak advorak/person.rb
Last active Aug 29, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.