diff options
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 20 |
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 |