aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb9
-rw-r--r--activerecord/test/cases/base_test.rb5
2 files changed, 3 insertions, 11 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index 792ffe1c5d..1654ae1eac 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -37,15 +37,12 @@ module ActiveRecord
relation
end
- def select(*args, &blk)
- if !block_given? && args.blank?
- raise ArgumentError
- end
+ def select(value = Proc.new)
if block_given?
- to_a.select {|*block_args| blk.call(*block_args) }
+ to_a.select {|*block_args| value.call(*block_args) }
else
relation = clone
- relation.select_values += args
+ relation.select_values += Array.wrap(value)
relation
end
end
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb
index 84b66fdf49..f2f5b73626 100644
--- a/activerecord/test/cases/base_test.rb
+++ b/activerecord/test/cases/base_test.rb
@@ -123,11 +123,6 @@ class BasicsTest < ActiveRecord::TestCase
assert_equal Topic.all.map(&:id).sort, topic_ids
end
- def test_select_symbol_for_many_arguments
- topics = Topic.select(:id, :author_name).map{|topic| [topic.id, topic.author_name]}.sort
- assert_equal Topic.all.map{|topic| [topic.id,topic.author_name]}.sort, topics
- end
-
def test_table_exists
assert !NonExistentTable.table_exists?
assert Topic.table_exists?