Skip to content
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

ActiveJob: delegate deserialization to the job class #18260

Merged
merged 1 commit into from
Dec 30, 2014

Conversation

isaacseymour
Copy link

Renames ActiveJob::Base.deserialize to ActiveJob::Base.instantitate_from_job_data (not convinced this is a good name), and delegates full deserialization to ActiveJob::Base#deserialize. This allows subclasses to override ActiveJob::Base#deserialize (they can already override #serialize) to attach metadata to the job. Without this, the only way to attach metadata to a job and retrieve it is by monkey-patching ActiveJob::Base.deserialize 🙈

@seuros
Copy link
Member

seuros commented Dec 30, 2014

cc @dhh

@dhh
Copy link
Member

dhh commented Dec 30, 2014

Looks good, but I don't think we need to change the class method. It's fine to have the class and instance methods both be called deserialize.

@isaacseymour
Copy link
Author

Updated. ActiveJob specs still pass locally. Shall I squash? Also, is there any chance of this making it onto 4-2-stable? I'm pretty sure it's completely non-breaking.

@dhh
Copy link
Member

dhh commented Dec 30, 2014

Please squash. I don't think it's a good idea to apply to stable. It's a feature upgrade.

On Dec 30, 2014, at 11:24, Isaac Seymour notifications@github.com wrote:

Updated. ActiveJob specs still pass locally. Shall I squash? Also, is there any chance of this making it onto 4-2-stable? I'm pretty sure it's completely non-breaking.


Reply to this email directly or view it on GitHub.

@isaacseymour isaacseymour force-pushed the active-job-delegate-deserialize branch from b3fb0ec to 96e196e Compare December 30, 2014 19:46
@isaacseymour
Copy link
Author

Cool, squashed 💃

@dhh
Copy link
Member

dhh commented Dec 30, 2014

Just need some docs too. Explain why the change was needed. Maybe give an example of how you'd overwrite the serializers.

@isaacseymour isaacseymour force-pushed the active-job-delegate-deserialize branch from 96e196e to 1a9ddad Compare December 30, 2014 23:13
@isaacseymour
Copy link
Author

Added docs and an example (it's pretty in-depth but I can't think of another decent one - shout if you want me to it down).

Not sure where I should explain the change - the ActiveJob CHANGELOG is empty and I can't find another AJ PR with a CHANGELOG entry.

@dhh
Copy link
Member

dhh commented Dec 30, 2014

You can have the honors of starting the CHANGELOG then :D

@dhh
Copy link
Member

dhh commented Dec 30, 2014

Just follow the pattern for any of the other frameworks.

@isaacseymour isaacseymour force-pushed the active-job-delegate-deserialize branch from 1a9ddad to 65542e2 Compare December 30, 2014 23:34
@isaacseymour
Copy link
Author

Done 🎉

@dhh
Copy link
Member

dhh commented Dec 30, 2014

Lovely!

dhh added a commit that referenced this pull request Dec 30, 2014
…ialize

ActiveJob: delegate deserialization to the job class
@dhh dhh merged commit a4d5e83 into rails:master Dec 30, 2014
robin850 added a commit that referenced this pull request Dec 31, 2014
Indent the list content by 4 spaces instead of 2 to match the other
changelog files. Also wrap the lines around 80 chars.

Finally update the documentation example with nit-picky things.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants