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

Fix #pluck method behavior when 3+ attributes specified #269

Merged
merged 2 commits into from Nov 28, 2022

Conversation

h6ah4i
Copy link
Contributor

@h6ah4i h6ah4i commented Nov 28, 2022

Hi. I noticed that ActiveHash's #pluck method behaves differently from ActiveRecord one. This pull request fixes the issue.

Current behavior (ActiveHash v3.1.1)

Category.pluck(:id, :name, :language)
=> [
  [[1, "US"], "English"],
  [[2, "Canada"], "English"],
  [[3, "Mexico"], "Spanish"]
]

Expected behavior (same as ActiveRecord)

Category.pluck(:id, :name, :language)
=> [
  [1, "US", "English"],
  [2, "Canada", "English"],
  [3, "Mexico", "Spanish"]
]

@h6ah4i h6ah4i force-pushed the fix/pluck-more-than-two-attrs branch from d863fc0 to 0c9fda6 Compare November 28, 2022 07:37
@kbrock kbrock added the bug label Nov 28, 2022
Copy link
Collaborator

@kbrock kbrock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. thanks for the tests

@kbrock kbrock merged commit cd24253 into active-hash:master Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants