Ticket #11562: patch_fix_dynamic_finders_on_associations_with_include_and_order.diff
| File patch_fix_dynamic_finders_on_associations_with_include_and_order.diff, 2.0 kB (added by jes5199, 3 months ago) |
|---|
-
activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
old new 87 87 :joins => @join_sql, 88 88 :readonly => false, 89 89 :order => @reflection.options[:order], 90 :include => @reflection.options[:include], 90 91 :limit => @reflection.options[:limit] } } 91 92 end 92 93 -
activerecord/lib/active_record/associations/has_many_association.rb
old new 100 100 create_scoping = {} 101 101 set_belongs_to_association_for(create_scoping) 102 102 { 103 :find => { :conditions => @finder_sql, :readonly => false, :order => @reflection.options[:order], :limit => @reflection.options[:limit] },103 :find => { :conditions => @finder_sql, :readonly => false, :order => @reflection.options[:order], :limit => @reflection.options[:limit], :include => @reflection.options[:include]}, 104 104 :create => create_scoping 105 105 } 106 106 end -
activerecord/lib/active_record/associations.rb
old new 1488 1488 end 1489 1489 1490 1490 def order_tables(options) 1491 order = options[:order]1491 order = [options[:order], scope(:find, :order) ].join(", ") 1492 1492 return [] unless order && order.is_a?(String) 1493 1493 order.scan(/([\.\w]+).?\./).flatten 1494 1494 end 1495 1495