diff options
Diffstat (limited to 'activerecord/test/fixtures')
-rw-r--r-- | activerecord/test/fixtures/author.rb | 10 | ||||
-rw-r--r-- | activerecord/test/fixtures/author_favorites.yml | 4 | ||||
-rw-r--r-- | activerecord/test/fixtures/db_definitions/schema.rb | 4 |
3 files changed, 17 insertions, 1 deletions
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 diff --git a/activerecord/test/fixtures/author_favorites.yml b/activerecord/test/fixtures/author_favorites.yml new file mode 100644 index 0000000000..e81fdac778 --- /dev/null +++ b/activerecord/test/fixtures/author_favorites.yml @@ -0,0 +1,4 @@ +david_mary: + id: 1 + author_id: 1 + favorite_author_id: 2
\ No newline at end of file diff --git a/activerecord/test/fixtures/db_definitions/schema.rb b/activerecord/test/fixtures/db_definitions/schema.rb index 6e8e23a9c4..7d10fbcadf 100644 --- a/activerecord/test/fixtures/db_definitions/schema.rb +++ b/activerecord/test/fixtures/db_definitions/schema.rb @@ -25,4 +25,8 @@ ActiveRecord::Schema.define do t.column :author_address_id, :integer end + create_table :author_favorites, :force => true do |t| + t.column :author_id, :integer + t.column :favorite_author_id, :integer + end end
\ No newline at end of file |