aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2011-07-26 16:12:17 +0200
committerPiotr Sarnacki <drogus@gmail.com>2011-07-26 16:15:12 +0200
commit14c6fca9cd2353e3b949e2683b69fac7e356097e (patch)
tree18643e3f6934505fe3298d6d722c65216d26e94a /activerecord/lib/active_record/relation
parent89f3d8a886ee6d678b60b5e5df4d3a11d93c53d4 (diff)
downloadrails-14c6fca9cd2353e3b949e2683b69fac7e356097e.tar.gz
rails-14c6fca9cd2353e3b949e2683b69fac7e356097e.tar.bz2
rails-14c6fca9cd2353e3b949e2683b69fac7e356097e.zip
Revert "allow select to have multiple arguments"
This reverts commit 04cc446d178653d362510e79a22db5300d463161. I reverted it because apparently we want to use: select([:a, :b]) instead of select(:a, :b), but there was no tests for that form.
Diffstat (limited to 'activerecord/lib/active_record/relation')
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb9
1 files changed, 3 insertions, 6 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