Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #12547 from derekprior/dp-fix-null-relation-pluck

Pluck on NullRelation should accept a list of columns
Conflicts:
	activerecord/CHANGELOG.md
  • Loading branch information...
commit 16587930025c6fe2f6615b292b6a339baae4c0dd 1 parent 8355355
@rafaelfranca rafaelfranca authored
View
7 activerecord/CHANGELOG.md
@@ -1,5 +1,12 @@
## unreleased ##
+* `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
2  activerecord/lib/active_record/null_relation.rb
@@ -6,7 +6,7 @@ def exec_queries
@records = []
end
- def pluck(_column_name)
+ def pluck(*column_names)
[]
end
View
2  activerecord/test/cases/relations_test.rb
@@ -269,7 +269,7 @@ def test_none_chainable_to_existing_scope_extension_method
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)
Please sign in to comment.
Something went wrong with that request. Please try again.