Skip to content
Browse files

Metaprogramming not needed here

  • Loading branch information...
1 parent 3344c01 commit 82dc16b7d2b6313117a42f7bf69a097b5ab79d1f @spastorino spastorino committed
Showing with 9 additions and 11 deletions.
  1. +9 −11 activerecord/lib/active_record/relation/query_methods.rb
View
20 activerecord/lib/active_record/relation/query_methods.rb
@@ -21,18 +21,16 @@ def #{query_method}(*args, &block)
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

0 comments on commit 82dc16b

Please sign in to comment.
Something went wrong with that request. Please try again.