Guest User

Untitled

a guest
Feb 19th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. diff -uNr rails/activerecord/lib/active_record/associations.rb rails-new/activerecord/lib/active_record/associations.rb
  2. --- rails/activerecord/lib/active_record/associations.rb 2006-07-07 06:58:22.000000000 -0400
  3. +++ rails-new/activerecord/lib/active_record/associations.rb 2006-07-14 11:40:30.000000000 -0400
  4. @@ -1150,8 +1150,8 @@
  5. add_limited_ids_condition!(sql, options, join_dependency) if !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit])
  6.  
  7. sql << "GROUP BY #{options[:group]} " if options[:group]
  8. - sql << "ORDER BY #{options[:order]} " if options[:order]
  9.  
  10. + add_order!(sql, options[:order])
  11. add_limit!(sql, options, scope) if using_limitable_reflections?(join_dependency.reflections)
  12.  
  13. return sanitize_sql(sql)
  14. diff -uNr rails/activerecord/test/base_test.rb rails-new/activerecord/test/base_test.rb
  15. --- rails/activerecord/test/base_test.rb 2006-07-08 16:35:56.000000000 -0400
  16. +++ rails-new/activerecord/test/base_test.rb 2006-07-14 12:01:54.000000000 -0400
  17. @@ -1242,6 +1242,16 @@
  18. assert_equal 2, topics.first.id
  19. end
  20.  
  21. + def test_scoped_find_order_including_has_many_association
  22. + developers = Developer.with_scope(:find => { :order => 'developers.salary DESC', :include => :projects }) do
  23. + Developer.find(:all)
  24. + end
  25. + assert developers.size >= 2
  26. + for i in 1...developers.size
  27. + assert developers[i-1].salary >= developers[i].salary
  28. + end
  29. + end
  30. +
  31. def test_base_class
  32. assert LoosePerson.abstract_class?
  33. assert !LooseDescendant.abstract_class?
Add Comment
Please, Sign In to add comment