1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Pluck on NullRelation accepts a list of columns

`pluck` was updated to accept a list of columns, but the `NullRelation`
was never updated to match that signature. As a result, calling `pluck`
on a `NullRelation` results in an `ArgumentError`.
This commit is contained in:
Derek Prior 2013-10-15 13:04:58 -04:00
parent dd37ff81d1
commit 23dfc39ed9
3 changed files with 9 additions and 2 deletions

View file

@ -1,3 +1,10 @@
* `NullRelation#pluck` takes a list of columns
The method signature in `NullRelation` was updated to mimic that in
`Calculations`.
*Derek Prior*
* `scope_chain` should not be mutated for other reflections.
Currently `scope_chain` uses same array for building different

View file

@ -6,7 +6,7 @@ module ActiveRecord
@records = []
end
def pluck(_column_name)
def pluck(*column_names)
[]
end

View file

@ -274,7 +274,7 @@ class RelationTest < ActiveRecord::TestCase
def test_none_chained_to_methods_firing_queries_straight_to_db
assert_no_queries do
assert_equal [], Developer.none.pluck(:id) # => uses select_all
assert_equal [], Developer.none.pluck(:id, :name)
assert_equal 0, Developer.none.delete_all
assert_equal 0, Developer.none.update_all(:name => 'David')
assert_equal 0, Developer.none.delete(1)