Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snake case attributes #507 #699

Closed

Conversation

joaomdmoura
Copy link
Member

Adding automatically treat to CamelCased attributes when using AMS Serializer gerenator.
It replaces the CamelCased attribute by a snake_cased one and defining a method to access the original attribute inside the serializer. For example:

class PostSerializer < ActiveModel::Serializer
  attributes :full_title, :body

  has_many :comments

  url :post

  def full_title
    object.fullTitle
  end
end

As I wrote on README:

CamelCased attributes will be converted to snake_case to ensure a AMS
approach consistence. It will be done be automaticly creating a method in the
generated serializer.

It is related to feature proposal #507 and other projects as Ember APIKit Rails

@kurko kurko added the V: 0.10.x label Jan 6, 2015
@kurko
Copy link
Member

kurko commented Jan 6, 2015

This is a clever addition, but I don't think it belongs into AMS. We can't guarantee that everyone will use snakecase. This PR, though, would make AMS not agnostic.

Perhaps we could think about some generator hook, so that you can add the generator to your app and AMS could check if you have a certain directory or something?

@joshsmith
Copy link
Contributor

@joaomdmoura Since we're trying to remain agnostic, what do you think of the response above? Also, projects like ember-appkit-rails are now deprecated entirely.

I'd recommend the linter approach mentioned in #507.

@kurko
Copy link
Member

kurko commented Mar 24, 2015

I'm giving this a close because it's stale for so long.

@kurko kurko closed this Mar 24, 2015
@joaomdmoura
Copy link
Member Author

Oo I didn't even remembered this PR hahahah sorry about that. Make yourself comfortable to close it 😝

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