-
Notifications
You must be signed in to change notification settings - Fork 954
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
Missing 'unscoped' in psych_ext #737
Conversation
…for delayed_jobs with default-scoped ActiveRecord arguments to function correctly (= as they used to in v.4.0.3). The error message in the rescue block is also broken, but this seems to be fixed in another pull request.
I am on the fence as to whether this is actually broken. I am leaning towards it being more correct the way it currently exists, but could be convinced otherwise. |
I don't think it is the business of Delayed Job to enforce the default scope or any other constraints of the arguments. Instead, it should make the delayed method calls work similarly to their non-delayed counterparts with a minimal amount of surprises. That's one of the main points of the whole system, right? Let's say I have an
and I would like to, for example, call
where If this change of behavior was intentional, it would have been nice to mention it in the change log. |
You are in for another unpleasant surprise with ActiveJob integration, as it will behave the same as DJ does now for all worker types. |
I also got bit by this change in behavior in Delayed Job 4.0.4 (and filed #740 before realizing there was already a PR up to fix the issue). This is a pretty big breaking change. Perhaps it could be deferred until Delayed Job 4.1 if you feel strongly about moving forward with it? If you do move forward with it, it would be nice to have an extension point or configuration setting to control this for those of us that depend on the current behavior (vs monkey patching the three places in the Delayed Job source code that do lookups of ActiveRecord objects). Default scopes are evil but many of us are stuck working on projects that rely heavily on them. At a minimum the current deserialization behavior in 4.0.4 is inconsistent: Note the catch block in the problematic case statement is also broken since it references undefined |
Hmm, if the lack of the call to As far as I understand, objects that are out of default scope can be dumped to the database, but then delayed_job will give me an error if I actually want to run that job with a serialized, out of default scope object. |
I agree with @ravicious . In the previous version, 4.0.3, it used to unscope default scope. After the update, the spec is suddenly changed. I think it's a bug. So hope this PR merged. Otherwise, we need to keep the spec consistent. |
Incorporated through another PR. This change is now in master. |
Was broken in commit a47e0d7. The find needs to be unscoped or delayed method calls with default-scoped ActiveRecord arguments do not work correctly (the same way the used to in delayed_job v.4.0.3). At least this broke our delayed_jobs...