aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-06-24 20:34:01 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2010-06-25 15:06:32 -0300
commit82dc16b7d2b6313117a42f7bf69a097b5ab79d1f (patch)
tree08da4c79bd06bc647063429fec71ea05d7ba77ce /activerecord
parent3344c011da17cb59f4452101c8e65067d7d30cce (diff)
downloadrails-82dc16b7d2b6313117a42f7bf69a097b5ab79d1f.tar.gz
rails-82dc16b7d2b6313117a42f7bf69a097b5ab79d1f.tar.bz2
rails-82dc16b7d2b6313117a42f7bf69a097b5ab79d1f.zip
Metaprogramming not needed here
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb20
1 files changed, 9 insertions, 11 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index e8d0f215f6..adc56fbef0 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -21,18 +21,16 @@ module ActiveRecord
CEVAL
end
- class_eval <<-CEVAL, __FILE__, __LINE__ + 1
- def select(*args)
- if block_given?
- to_a.select { |*block_args| yield(*block_args) }
- else
- new_relation = clone
- value = Array.wrap(args.flatten).reject {|x| x.blank? }
- new_relation.select_values += value if value.present?
- new_relation
- end
+ def select(*args)
+ if block_given?
+ to_a.select { |*block_args| yield(*block_args) }
+ else
+ new_relation = clone
+ value = Array.wrap(args.flatten).reject {|x| x.blank? }
+ new_relation.select_values += value if value.present?
+ new_relation
end
- CEVAL
+ end
[:where, :having].each do |query_method|
class_eval <<-CEVAL, __FILE__, __LINE__ + 1