Skip to content

ActiveJob: delegate deserialization to the job class#18260

Merged
dhh merged 1 commit into
rails:masterfrom
isaacseymour:active-job-delegate-deserialize
Dec 30, 2014
Merged

ActiveJob: delegate deserialization to the job class#18260
dhh merged 1 commit into
rails:masterfrom
isaacseymour:active-job-delegate-deserialize

Conversation

@isaacseymour
Copy link
Copy Markdown

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
Copy Markdown
Member

seuros commented Dec 30, 2014

cc @dhh

@dhh
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Author

Cool, squashed 💃

@dhh
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

dhh commented Dec 30, 2014

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

@dhh
Copy link
Copy Markdown
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
Copy Markdown
Author

Done 🎉

@dhh
Copy link
Copy Markdown
Member

dhh commented Dec 30, 2014

Lovely!

dhh pushed 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