Sha256: 2ccf4b4d5914a22ef685fc05105d6fb9c07ca6dfba89c780ccf5cf5c79c8e3a4
Contents?: true
Size: 951 Bytes
Versions: 15
Compression:
Stored size: 951 Bytes
Contents
[Back to Guides](../README.md) # Key Transforms Key Transforms modify the casing of keys and keys referenced in values in serialized responses. Provided key transforms: | Option | Result | |----|----| | `:camel` | ExampleKey | | `:camel_lower` | exampleKey | | `:dash` | example-key | | `:unaltered` | the original, unaltered key | | `:underscore` | example_key | | `nil` | use the adapter default | Key translation precedence is as follows: ##### Adapter option `key_transform` is provided as an option via render. ```render json: posts, each_serializer: PostSerializer, key_transform: :camel_lower``` ##### Configuration option `key_transform` is set in `ActiveModelSerializers.config.key_transform`. ```ActiveModelSerializers.config.key_transform = :camel_lower``` ##### Adapter default Each adapter has a default transform configured: | Adapter | Default Key Transform | |----|----| | `Json` | `:unaltered` | | `JsonApi` | `:dash` |
Version data entries
15 entries across 15 versions & 3 rubygems