Skip to content

Conversation

@beauby
Copy link
Contributor

@beauby beauby commented Jun 7, 2016

Purpose

TBA

Changes

TBA

Caveats

None 😎

Related GitHub issues

#1234

Additional helpful information

Tests are currently failing because they were testing implem rather than behavior.

# Used by adapter as resource root.
def json_key
root || _type || object.class.model_name.to_s.underscore
_type || object.class.model_name.to_s.underscore
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is now done here.

Copy link
Member

Choose a reason for hiding this comment

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

as https://github.com/rails-api/active_model_serializers/pull/1782/files#r66382756 I'm fine removing root as a public interface, or in the initializer, but it should still be an option to as_json

class Serializer
# @see #serializable_hash for more details on these valid keys.
SERIALIZABLE_HASH_VALID_KEYS = [:only, :except, :methods, :include, :root].freeze
SERIALIZABLE_HASH_VALID_KEYS = [:only, :except, :methods, :include].freeze
Copy link
Member

Choose a reason for hiding this comment

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

root still belongs here, though technically it is an option for as_json. This isn't about partitioning and need not be changed. In fact, it's an option in the ActiveModel::Serializers::JSON interface

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, will revert.

@bf4 bf4 mentioned this pull request Jun 10, 2016
@beauby beauby closed this Jul 28, 2017
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.

2 participants