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

ActiveRecord::Base.pluck_each function #4

Closed
wants to merge 7 commits into from

Conversation

DarthSim
Copy link

ActiveRecord::Base.pluck_each and ActiveRecord::Relation#pluck_each act as combination of pluck and each_row.
You can request for many attributes and associations attributes like this:

Model.pluck_each(:id, :name, child: [:id, :name, { nested_child: :address }]) do |row| 
  # do something here
end

@afair
Copy link
Owner

afair commented Jun 10, 2014

I love this feature, but the amount if code would more than double the size of this library, and be harder to maintain.

Also, I had to refactor the library to use better integration with ActiveRecord, which is hard enough to track it's internal changes. My v0.5 branch/release should be a better working model going forward.

Because of your need, I added s light-weight pluck_row/pluck_instance feature. It doesn't do deep plucking like your solution, but I hope would give some people an option.

If you believe in your solution, why not try creating a solution on top of this library, as an enhancement/plugin gem?

Thanks!

@afair afair closed this Jun 10, 2014
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.

None yet

2 participants