forked from rails-api/active_model_serializers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't pluralize the CollectionSerializer#root for #json_key
One of three constituents is used to provide the CollectionSerializer's #json_key: 1) the :root option - controlled by the caller 2) the #name of the first resource serializer - the root or underscored model name 3) the underscored #name of the resources object - generally equivalent to the underscored model name of rails-api#2 Of the three, only the latter 2 are out of the callers control, and only the latter two are expected to be singular by default. Not pluralizing the root gives the caller additional flexibility in defining the desired root, whether conventionally plural, unconventionally plural (e.g. objects_received:) or singular.
- Loading branch information
Showing
4 changed files
with
22 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters