aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPivotal Labs <pivotal@lapidge.flood.pivotallabs.com>2009-01-09 12:13:17 -0800
committerVijay Dev <vijaydev.cse@gmail.com>2010-12-16 01:49:30 +0530
commit15984dbe35651e64dcff69f8e48fca156c380df2 (patch)
treef30eb76daabbad341760ff0011b458cde6856e9e
parent4cd3302279f4ab5af642a1cd4e601b676ba6278b (diff)
downloadrails-15984dbe35651e64dcff69f8e48fca156c380df2.tar.gz
rails-15984dbe35651e64dcff69f8e48fca156c380df2.tar.bz2
rails-15984dbe35651e64dcff69f8e48fca156c380df2.zip
test for eager load of has_one association with condition on the through table
-rw-r--r--activerecord/test/cases/associations/eager_test.rb10
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 }