Skip to content

Conversation

cball
Copy link
Contributor

@cball cball commented Oct 26, 2013

When adding an association, the key is overridden by passing root in the options (not key as it was previously). I assume this is the intended behavior so this keeps the README in sync.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) when pulling 3b9b4d7 on cball:update-association-key-in-readme into d5308b4 on rails-api:master.

@spastorino
Copy link
Contributor

What happens is that key is used when you embed ids and root is used when you embed objects.
As shown here https://github.com/rails-api/active_model_serializers/blob/master/lib/active_model/serializer.rb#L130-134

spastorino added a commit that referenced this pull request Oct 26, 2013
Update README to reflect override of json key in associations
@spastorino spastorino merged commit 74d19e7 into rails-api:master Oct 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants