aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-10-02 21:45:46 +0100
committerJon Leighton <j@jonathanleighton.com>2010-10-02 21:45:46 +0100
commita34391c3b495bad268204bdf4f6b3483a61abcd5 (patch)
tree7e6cb70fbe87bfde123b4aef097d85d5ea81015f /activerecord/test/models
parent34ee586e993ad9e466b81f376fa92feb5d312b4c (diff)
downloadrails-a34391c3b495bad268204bdf4f6b3483a61abcd5.tar.gz
rails-a34391c3b495bad268204bdf4f6b3483a61abcd5.tar.bz2
rails-a34391c3b495bad268204bdf4f6b3483a61abcd5.zip
Add support for table aliasing, with a test that needs aliasing in order to work correctly. This test incidentally provides a more complicated test case (4 inner joins, 2 using polymorphism).
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/author.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb
index 1efb4fc095..1fbd729b60 100644
--- a/activerecord/test/models/author.rb
+++ b/activerecord/test/models/author.rb
@@ -84,8 +84,9 @@ class Author < ActiveRecord::Base
has_many :favorite_authors, :through => :author_favorites, :order => 'name'
has_many :tagging, :through => :posts # through polymorphic has_one
- has_many :taggings, :through => :posts, :source => :taggings # through polymorphic has_many TODO: Why is the :source needed?
+ has_many :taggings, :through => :posts # through polymorphic has_many
has_many :tags, :through => :posts # through has_many :through (on source reflection + polymorphic)
+ 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