diff options
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rwxr-xr-x | activerecord/lib/active_record/associations.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 8434644325..4743d3be8f 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1365,11 +1365,15 @@ module ActiveRecord def include_eager_order?(options) order = options[:order] return false unless order - order.scan(/([\.\w]+)\.\w+/).flatten.any? do |order_table_name| + order.to_s.scan(/([\.\w]+)\.\w+/).flatten.any? do |order_table_name| order_table_name != table_name end end + def references_eager_loaded_tables?(options) + include_eager_order?(options) || include_eager_conditions?(options) + end + def using_limitable_reflections?(reflections) reflections.reject { |r| [ :belongs_to, :has_one ].include?(r.macro) }.length.zero? end |