diff options
author | Tiago Macedo <tmacedo@webreakstuff.com> | 2008-06-08 17:00:56 +0100 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-06-08 13:01:55 -0700 |
commit | a2f6ded73209eeb9c6843b16c0253bbe56236b29 (patch) | |
tree | 475cbf39c3f042dfe67f94168389930a861b4582 /activerecord/test/cases | |
parent | 138adbf156905f5cc6669ba33dd94802c82514d9 (diff) | |
download | rails-a2f6ded73209eeb9c6843b16c0253bbe56236b29.tar.gz rails-a2f6ded73209eeb9c6843b16c0253bbe56236b29.tar.bz2 rails-a2f6ded73209eeb9c6843b16c0253bbe56236b29.zip |
Fix conditions and order on join tables with limited eager loading. [#372 state:resolved]
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/associations/eager_test.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index 3a3358e39b..f65ada550b 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -14,11 +14,14 @@ require 'models/job' require 'models/subscriber' require 'models/subscription' require 'models/book' +require 'models/developer' +require 'models/project' class EagerAssociationTest < ActiveRecord::TestCase fixtures :posts, :comments, :authors, :categories, :categories_posts, :companies, :accounts, :tags, :taggings, :people, :readers, - :owners, :pets, :author_favorites, :jobs, :references, :subscribers, :subscriptions, :books + :owners, :pets, :author_favorites, :jobs, :references, :subscribers, :subscriptions, :books, + :developers, :projects def test_loading_with_one_association posts = Post.find(:all, :include => :comments) @@ -609,4 +612,12 @@ class EagerAssociationTest < ActiveRecord::TestCase Comment.find :all, :include => :post end end + + def test_conditions_on_join_table_with_include_and_limit + assert_equal 3, Developer.find(:all, :include => 'projects', :conditions => 'developers_projects.access_level = 1', :limit => 5).size + end + + def test_order_on_join_table_with_include_and_limit + assert_equal 5, Developer.find(:all, :include => 'projects', :order => 'developers_projects.joined_on DESC', :limit => 5).size + end end |