diff options
author | Rick Olson <technoweenie@gmail.com> | 2006-03-16 06:17:54 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2006-03-16 06:17:54 +0000 |
commit | a3502c419e621c6abac2a9e047e42a582fd80769 (patch) | |
tree | c9bf8c4843816babe39e4a276f7f6bdb38206687 /activerecord/test/fixtures | |
parent | fd87a787101e4b58249bf953ada756b992dff5f5 (diff) | |
download | rails-a3502c419e621c6abac2a9e047e42a582fd80769.tar.gz rails-a3502c419e621c6abac2a9e047e42a582fd80769.tar.bz2 rails-a3502c419e621c6abac2a9e047e42a582fd80769.zip |
Use association's :conditions when eager loading. [jeremyevans0@gmail.com] closes #4144
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3897 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/fixtures')
-rw-r--r-- | activerecord/test/fixtures/author.rb | 3 | ||||
-rw-r--r-- | activerecord/test/fixtures/categories_posts.yml | 4 | ||||
-rw-r--r-- | activerecord/test/fixtures/category.rb | 3 |
3 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/fixtures/author.rb b/activerecord/test/fixtures/author.rb index 3138dfca57..8c6cee51e4 100644 --- a/activerecord/test/fixtures/author.rb +++ b/activerecord/test/fixtures/author.rb @@ -4,6 +4,9 @@ class Author < ActiveRecord::Base has_many :posts_with_categories, :include => :categories, :class_name => "Post" has_many :posts_with_comments_and_categories, :include => [ :comments, :categories ], :order => "posts.id", :class_name => "Post" + has_many :special_posts, :class_name => "Post" + has_many :hello_posts, :class_name => "Post", :conditions=>"\#{aliased_table_name}.body = 'hello'" + has_many :nonexistent_posts, :class_name => "Post", :conditions=>"\#{aliased_table_name}.body = 'nonexistent'" has_many :posts_with_callbacks, :class_name => "Post", :before_add => :log_before_adding, :after_add => :log_after_adding, :before_remove => :log_before_removing, :after_remove => :log_after_removing diff --git a/activerecord/test/fixtures/categories_posts.yml b/activerecord/test/fixtures/categories_posts.yml index 0d77d8c05f..9b67ab4fa4 100644 --- a/activerecord/test/fixtures/categories_posts.yml +++ b/activerecord/test/fixtures/categories_posts.yml @@ -17,3 +17,7 @@ general_sti_habtm: sti_test_sti_habtm: category_id: 3 post_id: 6 + +general_hello: + category_id: 1 + post_id: 4 diff --git a/activerecord/test/fixtures/category.rb b/activerecord/test/fixtures/category.rb index 9be459a80f..6917c51d34 100644 --- a/activerecord/test/fixtures/category.rb +++ b/activerecord/test/fixtures/category.rb @@ -1,5 +1,8 @@ class Category < ActiveRecord::Base has_and_belongs_to_many :posts + has_and_belongs_to_many :special_posts, :class_name => "Post" + has_and_belongs_to_many :hello_posts, :class_name => "Post", :conditions => "\#{aliased_table_name}.body = 'hello'" + has_and_belongs_to_many :nonexistent_posts, :class_name => "Post", :conditions=>"\#{aliased_table_name}.body = 'nonexistent'" def self.what_are_you 'a category...' |