-
Notifications
You must be signed in to change notification settings - Fork 8
Casing
Jasiek Matusz edited this page Feb 6, 2020
·
3 revisions
If the input is in a different convention than :snake
, you should specify that.
You can do it in two ways:
- in an initializer, simply create
initializers/jsonapi_parameters.rb
with contents similar to:
# config/initializers/jsonapi_parameters.rb
JsonApi::Parameters.ensure_underscore_translation = true
- while calling
.from_jsonapi
, for instance:.from_jsonapi(:camel)
. The value does not really matter, as anything different than:snake
will result in deep keys transformation provided by ActiveSupport.
In 2.0 a breaking change for casing has been introduced. Prior to 2.0, type
value was not a subject to casing translation. From 2.0 onwards we also translate the entity type to match what was configured for JsonApi::Parameters.