Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move array_of_strings? to Relation

  • Loading branch information...
commit 5502780c6910fbf6825efa58601d868fca2f1cc1 1 parent 394c05e
@lifo lifo authored
View
4 activerecord/lib/active_record/base.rb
@@ -1455,10 +1455,6 @@ def construct_finder_arel(options = {}, scope = nil)
relation
end
- def array_of_strings?(o)
- o.is_a?(Array) && o.all?{|obj| obj.is_a?(String)}
- end
-
def type_condition
sti_column = arel_table[inheritance_column]
condition = sti_column.eq(sti_name)
View
8 activerecord/lib/active_record/relation/query_methods.rb
@@ -77,7 +77,7 @@ def build_arel
# Build association joins first
joins.each do |join|
- association_joins << join if [Hash, Array, Symbol].include?(join.class) && !@klass.send(:array_of_strings?, join)
+ association_joins << join if [Hash, Array, Symbol].include?(join.class) && !array_of_strings?(join)
end
if association_joins.any?
@@ -110,7 +110,7 @@ def build_arel
when Relation::JoinOperation
arel = arel.join(join.relation, join.join_class).on(*join.on)
when Hash, Array, Symbol
- if @klass.send(:array_of_strings?, join)
+ if array_of_strings?(join)
join_string = join.join(' ')
arel = arel.join(join_string)
end
@@ -193,5 +193,9 @@ def reverse_sql_order(order_query)
}.join(',')
end
+ def array_of_strings?(o)
+ o.is_a?(Array) && o.all?{|obj| obj.is_a?(String)}
+ end
+
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.