From c8470f8a5b74eefd498397a8effdf37b4dc28674 Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Tue, 21 Mar 2006 01:07:16 +0000 Subject: add self referential has_many :through example [Rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4006 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/fixtures/author.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'activerecord/test/fixtures/author.rb') diff --git a/activerecord/test/fixtures/author.rb b/activerecord/test/fixtures/author.rb index e510dd1992..df78a7ada8 100644 --- a/activerecord/test/fixtures/author.rb +++ b/activerecord/test/fixtures/author.rb @@ -25,9 +25,12 @@ class Author < ActiveRecord::Base has_many :categorizations has_many :categories, :through => :categorizations - + has_many :nothings, :through => :kateggorisatons, :class_name => 'Category' + has_many :author_favorites + has_many :favorite_authors, :through => :author_favorites, :order => 'name' + belongs_to :author_address attr_accessor :post_log @@ -60,4 +63,9 @@ end class AuthorAddress < ActiveRecord::Base has_one :author +end + +class AuthorFavorite < ActiveRecord::Base + belongs_to :author + belongs_to :favorite_author, :class_name => "Author", :foreign_key => 'favorite_author_id' end \ No newline at end of file -- cgit v1.2.3