aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-10-12 18:16:31 +0100
committerJon Leighton <j@jonathanleighton.com>2010-10-12 18:16:31 +0100
commitc37a5e7acde436b359043a67b7daace8be6f08c6 (patch)
treedc89f219e6aa0be327a35c921ed8b9f005882902 /activerecord/test/models
parent56064aa4b014233ae54413628679b7f7fa5d6f77 (diff)
downloadrails-c37a5e7acde436b359043a67b7daace8be6f08c6.tar.gz
rails-c37a5e7acde436b359043a67b7daace8be6f08c6.tar.bz2
rails-c37a5e7acde436b359043a67b7daace8be6f08c6.zip
Add a commented, failing test for using a habtm in a has many through association. I want to refactor how aliasing works first.
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/author.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb
index 1fbd729b60..584164f19a 100644
--- a/activerecord/test/models/author.rb
+++ b/activerecord/test/models/author.rb
@@ -83,9 +83,9 @@ class Author < ActiveRecord::Base
has_many :author_favorites
has_many :favorite_authors, :through => :author_favorites, :order => 'name'
- has_many :tagging, :through => :posts # through polymorphic has_one
- has_many :taggings, :through => :posts # through polymorphic has_many
- has_many :tags, :through => :posts # through has_many :through (on source reflection + polymorphic)
+ has_many :tagging, :through => :posts
+ has_many :taggings, :through => :posts
+ has_many :tags, :through => :posts
has_many :similar_posts, :through => :tags, :source => :tagged_posts
has_many :distinct_tags, :through => :posts, :source => :tags, :select => "DISTINCT tags.*", :order => "tags.name"
has_many :post_categories, :through => :posts, :source => :categories
@@ -100,6 +100,8 @@ class Author < ActiveRecord::Base
belongs_to :author_address, :dependent => :destroy
belongs_to :author_address_extra, :dependent => :delete, :class_name => "AuthorAddress"
+ has_many :post_categories, :through => :posts, :source => :categories
+
scope :relation_include_posts, includes(:posts)
scope :relation_include_tags, includes(:tags)