diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-01-20 14:01:42 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-01-20 14:01:42 +0530 |
commit | 5502780c6910fbf6825efa58601d868fca2f1cc1 (patch) | |
tree | 328a7dbcf446b5e11be6fb1e5185a00bb9a6f70b /activerecord/lib | |
parent | 394c05ed82c1fbfc1c5d27f223b49975f439729c (diff) | |
download | rails-5502780c6910fbf6825efa58601d868fca2f1cc1.tar.gz rails-5502780c6910fbf6825efa58601d868fca2f1cc1.tar.bz2 rails-5502780c6910fbf6825efa58601d868fca2f1cc1.zip |
Move array_of_strings? to Relation
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 4 | ||||
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 8fcc872113..8f2ea10206 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1455,10 +1455,6 @@ module ActiveRecord #:nodoc: 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) diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index a3ac58bc81..163d698b5c 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -77,7 +77,7 @@ module ActiveRecord # 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 @@ module ActiveRecord 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 @@ module ActiveRecord }.join(',') end + def array_of_strings?(o) + o.is_a?(Array) && o.all?{|obj| obj.is_a?(String)} + end + end end |