mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Metaprogramming not needed here
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user