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

Make serializers serializable, step 1. #1494

Merged
merged 1 commit into from
Mar 13, 2016

Conversation

bf4
Copy link
Member

@bf4 bf4 commented Feb 3, 2016

I think this is a first step in a good idea...

This comes up not infrequently, especially as it was an interface in previous releases.

Now, a serializer responds to serializable_hash, as_json, to_json, to_h, and to_hash as is expected from experience, and sorta makes sense, as well. (to_h and to_hash are sentinels Ruby uses for generating json etc)

e.g. #1487

Obviously it needs tests, but I wanted to just get the idea out there.

re step 2, it's non-trivial.. I futzed a bit in bf4/active_model_serializers@serializable_serializer...serializable_serializers and bf4/active_model_serializers@serializable_serializer...serializable_serializers_take1

ref:

@bf4 bf4 force-pushed the serializable_serializer branch from d786cff to fb8a093 Compare February 5, 2016 04:28
# TODO: Move to here the Attributes adapter logic for
# +serializable_hash_for_single_resource(options)+
# and include <tt>ActiveModel::Serializers::JSON</tt>.
# So that the below is true:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and include ActiveModel::Serializers::JSON. So that the below is true:

this is really a new feature that probably be implemented

@bf4
Copy link
Member Author

bf4 commented Feb 10, 2016

ref: #1380

@bf4 bf4 force-pushed the serializable_serializer branch from 7071260 to b169ed3 Compare March 13, 2016 06:26
bf4 added a commit that referenced this pull request Mar 13, 2016
Make serializers serializable, step 1.
@bf4 bf4 merged commit 0d1f770 into rails-api:master Mar 13, 2016
@bf4 bf4 deleted the serializable_serializer branch March 13, 2016 06:52
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.

1 participant