Skip to content

Conversation

@beauby
Copy link
Contributor

@beauby beauby commented Oct 5, 2015

This option is clearly an adapter concern and it is only used in the Json adapter.

  • Custom root are not subject to inflection anymore.

Most tests are failing because they are directly testing the root value on the serializers. Will fix.

Copy link
Member

Choose a reason for hiding this comment

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

use the serializable helper to for less words, if you want

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is the helper globally available? I think it should be. If so, I'll update these tests.

@bf4
Copy link
Member

bf4 commented Oct 6, 2015

@beauby Would you clarify what root and json_key mean in context? I thought it was the root for each resource, which would mean it's per serialized resource, no? (But now that we have Serializer::type maybe that replaces this?)

@beauby
Copy link
Contributor Author

beauby commented Oct 6, 2015

@bf4: No, they were only referring to the root of the document, that's why I believe it's an adapter concern. For the "roots" of resources, we actually use the association's key.

@beauby beauby force-pushed the move-root-to-adapter3 branch from 6f0e992 to ec55c81 Compare October 19, 2015 01:13
@beauby
Copy link
Contributor Author

beauby commented Oct 19, 2015

Updated.

Copy link
Member

Choose a reason for hiding this comment

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

this raises a huge red flag for me. Why is this changing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe it should not have been there in the first place. Modifying explicitly supplied options is such an antipattern. I could move this change to an other PR though.

@NullVoxPopuli
Copy link
Contributor

is this still applicable?

@bf4
Copy link
Member

bf4 commented Mar 10, 2016

Done, iirc

B mobile phone

On Mar 10, 2016, at 4:59 AM, L. Preston Sego III notifications@github.com wrote:

is this still applicable?


Reply to this email directly or view it on GitHub.

@remear
Copy link
Member

remear commented Mar 15, 2016

Can this be closed then?

@beauby
Copy link
Contributor Author

beauby commented Mar 16, 2016

Seems not: https://github.com/rails-api/active_model_serializers/blob/master/lib/active_model/serializable_resource.rb#L5
As you can see, :root is not an adapter option yet.

@bf4
Copy link
Member

bf4 commented Apr 1, 2016

@beauby I would love if you'd come back to this one. Shouldn't be to hard to finish.

@beauby
Copy link
Contributor Author

beauby commented Apr 9, 2016

Will take care of it over the weekend!

@beauby
Copy link
Contributor Author

beauby commented Jun 7, 2016

Closing in favor of #1782.

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.

4 participants