From 82dc16b7d2b6313117a42f7bf69a097b5ab79d1f Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Thu, 24 Jun 2010 20:34:01 -0300 Subject: Metaprogramming not needed here --- .../lib/active_record/relation/query_methods.rb | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'activerecord') 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 -- cgit v1.2.3