Skip to content

Conversation

@beauby
Copy link
Contributor

@beauby beauby commented Sep 7, 2015

This is a response to #974. The idea is that client-side libraries have different conventions on the format of the type attribute, which this PR offers to set globally as a lambda.
I'm interested in opinions on the best way to offer a good experience with this. A few leads:

  • Having a few available lambdas (like pluralize_dasherize, singularize_camelize, etc)
  • Offering the possibility to chain some provided "formatters", possibly with a mix of lambdas as well (like [ :pluralize, :underscore, -> (x) { ... } ]

This is also related to #1029 (although the solution here is to globally handle the formatting, where #1029 offers to set it at the serializer level).

@beauby
Copy link
Contributor Author

beauby commented Sep 7, 2015

This PR actually also provides the possibility to override the type at the serializer level, simply by defining the type method on the serializer.

@beauby beauby mentioned this pull request Sep 7, 2015
@bf4
Copy link
Member

bf4 commented Sep 9, 2015

I'm thinking this should wait for deserliazation, since any deviation from snake_case would make a rails-to-rails json-api not work (and ember, fwiw, already supports this typo of mapping). esp see https://github.com/ember-data/active-model-adapter/blob/210c2302edfe2c2a3c375668411ffa81ef77dfe3/addon/active-model-adapter.js which comes with ember-rails https://github.com/emberjs/ember-rails

@bf4
Copy link
Member

bf4 commented Feb 17, 2016

ref: rails/rails#20389

@remear remear closed this Mar 17, 2016
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.

3 participants