Metaprogramming not needed here

This commit is contained in:
Santiago Pastorino
2010-06-24 20:34:01 -03:00
parent 3344c011da
commit 82dc16b7d2

View File

@@ -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