mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Removes useless flatten
This commit is contained in:
committed by
wycats
parent
a39f2657b1
commit
64fee27a55
@@ -9,10 +9,9 @@ module ActiveRecord
|
||||
(ActiveRecord::Relation::ASSOCIATION_METHODS + ActiveRecord::Relation::MULTI_VALUE_METHODS).each do |query_method|
|
||||
attr_accessor :"#{query_method}_values"
|
||||
|
||||
next if [:where, :having, :select].include?(query_method)
|
||||
next if [:where, :having, :select, :joins].include?(query_method)
|
||||
class_eval <<-CEVAL, __FILE__, __LINE__ + 1
|
||||
def #{query_method}(*args)
|
||||
args.flatten!
|
||||
args.reject! { |a| a.blank? }
|
||||
new_relation = clone
|
||||
new_relation.#{query_method}_values += args if args.present?
|
||||
@@ -22,7 +21,6 @@ module ActiveRecord
|
||||
end
|
||||
|
||||
def reorder(*args)
|
||||
args.flatten!
|
||||
args.reject! { |a| a.blank? }
|
||||
new_relation = clone
|
||||
new_relation.order_values = args if args.present?
|
||||
@@ -33,7 +31,6 @@ module ActiveRecord
|
||||
if block_given?
|
||||
to_a.select { |*block_args| yield(*block_args) }
|
||||
else
|
||||
args.flatten!
|
||||
args.reject! { |a| a.blank? }
|
||||
new_relation = clone
|
||||
new_relation.select_values += args if args.present?
|
||||
@@ -41,6 +38,14 @@ module ActiveRecord
|
||||
end
|
||||
end
|
||||
|
||||
def joins(*args)
|
||||
args.flatten!
|
||||
args.reject! { |a| a.blank? }
|
||||
new_relation = clone
|
||||
new_relation.joins_values += args if args.present?
|
||||
new_relation
|
||||
end
|
||||
|
||||
[:where, :having].each do |query_method|
|
||||
class_eval <<-CEVAL, __FILE__, __LINE__ + 1
|
||||
def #{query_method}(*args)
|
||||
|
||||
Reference in New Issue
Block a user