raise on serializing an unsaved model object to a delayed job, refs #1
Right now we serialize the AR object without an id, and fail later when trying to perform the job, since we can't find the object without an id. This change will make it a lot easier to track down these kinds of errors. Change-Id: I89d7fb45182f6624bd7fee9b01c1294112a0ba8b Reviewed-on: https://gerrit.instructure.com/2354 Reviewed-by: Bracken Mosbacker <bracken@instructure.com> Tested-by: Hudson <hudson@instructure.com>
This commit is contained in:
parent
e797890421
commit
7bafbd0dab
|
@ -10,6 +10,9 @@ class ActiveRecord::Base
|
|||
end
|
||||
|
||||
def dump_for_delayed_job
|
||||
if id.nil?
|
||||
raise("Can't serialize unsaved ActiveRecord object for delayed job: #{self.inspect}")
|
||||
end
|
||||
"#{self.class};#{id}"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue