Du kan også foretage en transaktion. Ligesom eksemplet nedenfor:
transaction do
thing = Thing.find(1)
puts thing.foo # outputs "old value"
thing.foo = "new value"
thing.save
end
ThingProcessor.queue_job(thing.id)
Opdatering:der er en perle, der kalder After Transaction, med denne kan du løse dit problem. Her er linket:http://xtargets.com/2012/03/08/understanding-and-solving-race-conditions-with-ruby-rails-and-background-workers/