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

Select fields using strings or symbols, array or not #183

Merged
merged 1 commit into from
Jun 7, 2016

Conversation

KevinBongart
Copy link
Contributor

Hi! Thanks for this nice and useful gem.

I ran into a tiny inconvenience:

Article.select("title,body").first
# all good
Article.select(["title", "body"]).first
# error

So I thought people who are used to Ruby's flexibility could benefit from calling this method in various convenient ways:

Article.select("title,body").first
Article.select(["title", "body"]).first
Article.select([:title, :body]).first
Article.select("title", "body").first
Article.select(:title, :body).first

(I personally enjoy the last one since ActiveRecord allows the same style, but to each their own.)

This PR brings a patch and a few tests, and if you think this small feature could be useful, I'm happy to refactor a bit with more explicit names, add a comment about the method params, and update the README.

Thanks!

@chingor13 chingor13 merged commit ffbbe36 into JsonApiClient:master Jun 7, 2016
@chingor13
Copy link
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants