rails/rails — pull request #8176 by senny (2012-11-11 16:25:28+00:00)
Title: `#pluck` can be used on a relation with `select` clause (#7551)

I changed `#pluck` to spawn a new relation and then modify the `select_values` directly to ignore previously present `select` clauses. This patch simply ignores present `select` clauses.

There was also trailing whitespace in the `CHANGELOG.md` (created a separate commit to remove it, so that it's easier to backport)

This is a fix for #7551

The `ActiveRecord::Calculations` module has a couple of methods, which modify the `select_values` of a relation directly. I thought about a small refactoring to expose a method on `ActiveRecord::QueryMethods` to assign fields directly to `select_values` instead of concatenate them as `select` does. This could be named something like `#select_only` or `#force_select` (could also be implemented with a parameter to `select` like `:force => true` or `:override => true`.
I wanted to submit this PR first though to ask wether this is necessary or not.