-
Notifications
You must be signed in to change notification settings - Fork 956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delayed::DeserializationError if a method parameter is an unsaved ActiveRecord object #619
Comments
it seems that it has already been decided that it's "not a bug": I still do no understand what concurrency issues can arise. Would it be possible to add a configuration ? |
Yes this is intended. It will NOT change. For one of many examples, say you have a new record, you delay something on that record. After the job is sent off you save that record. Then in the job you do stuff and save the record. Now you have 2 records based on the same root record that you probably didn't intend. |
If the active record object is converted to a hash, there wont be such problem |
@cyrilchampier This is an edge case that almost always signals a bug in the caller's code. If you have a case where you want to delay the creation of an object, just write a custom Job that takes a hash of attributes. |
If I remember well, I wanted to send a mail after the deletion of an user. |
why not just unserialize the object instead of trying to fetch the current version ?
Edit:
as said here:
https://github.com/collectiveidea/delayed_job/wiki/Common-problems#dj-doesnt-deserialize-an-unsaved-activerecord-model
"it's not a bug, it's a feature"
but why not simply fallback to 'visit_Psych_Nodes_Mapping_without_class' if id is nil ?
The text was updated successfully, but these errors were encountered: