diff options
author | Pivotal Labs <pivotal@lapidge.flood.pivotallabs.com> | 2009-01-09 12:13:17 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-15 11:23:39 -0800 |
commit | 6df88f0d2c5fb65f5b94b6c553b000098b9f2eee (patch) | |
tree | 562f28012345c026f8b963aae51f9893c091615d /activerecord/test | |
parent | 5d78b4c6f7829498e5d2a8cd4fceca0e24a3f64e (diff) | |
download | rails-6df88f0d2c5fb65f5b94b6c553b000098b9f2eee.tar.gz rails-6df88f0d2c5fb65f5b94b6c553b000098b9f2eee.tar.bz2 rails-6df88f0d2c5fb65f5b94b6c553b000098b9f2eee.zip |
test for eager load of has_one association with condition on the through table
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/associations/eager_test.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index c96ca90750..34a1cdeebe 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -17,18 +17,26 @@ require 'models/subscription' require 'models/book' require 'models/developer' require 'models/project' +require 'models/member' +require 'models/membership' +require 'models/club' class EagerAssociationTest < ActiveRecord::TestCase fixtures :posts, :comments, :authors, :author_addresses, :categories, :categories_posts, :companies, :accounts, :tags, :taggings, :people, :readers, :owners, :pets, :author_favorites, :jobs, :references, :subscribers, :subscriptions, :books, - :developers, :projects, :developers_projects + :developers, :projects, :developers_projects, :members, :memberships, :clubs def setup # preheat table existence caches Comment.find_by_id(1) end + def test_eager_with_has_one_through_join_model_with_conditions_on_the_through + member = Member.find(members(:some_other_guy).id, :include => :favourite_club) + assert_nil member.favourite_club + end + def test_loading_with_one_association posts = Post.find(:all, :include => :comments) post = posts.find { |p| p.id == 1 } |