aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/fixtures
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/fixtures')
-rw-r--r--activerecord/test/fixtures/book.rb4
-rw-r--r--activerecord/test/fixtures/books.yml7
-rw-r--r--activerecord/test/fixtures/citation.rb6
-rw-r--r--activerecord/test/fixtures/db_definitions/schema.rb9
4 files changed, 26 insertions, 0 deletions
diff --git a/activerecord/test/fixtures/book.rb b/activerecord/test/fixtures/book.rb
new file mode 100644
index 0000000000..cfd07abddc
--- /dev/null
+++ b/activerecord/test/fixtures/book.rb
@@ -0,0 +1,4 @@
+class Book < ActiveRecord::Base
+ has_many :citations, :foreign_key => 'book1_id'
+ has_many :references, :through => :citations, :source => :reference_of, :uniq => true
+end
diff --git a/activerecord/test/fixtures/books.yml b/activerecord/test/fixtures/books.yml
new file mode 100644
index 0000000000..473663ff5b
--- /dev/null
+++ b/activerecord/test/fixtures/books.yml
@@ -0,0 +1,7 @@
+awdr:
+ id: 1
+ name: "Agile Web Development with Rails"
+
+rfr:
+ id: 2
+ name: "Ruby for Rails"
diff --git a/activerecord/test/fixtures/citation.rb b/activerecord/test/fixtures/citation.rb
new file mode 100644
index 0000000000..545aa8110d
--- /dev/null
+++ b/activerecord/test/fixtures/citation.rb
@@ -0,0 +1,6 @@
+class Citation < ActiveRecord::Base
+ belongs_to :reference_of, :class_name => "Book", :foreign_key => :book2_id
+
+ belongs_to :book1, :class_name => "Book", :foreign_key => :book1_id
+ belongs_to :book2, :class_name => "Book", :foreign_key => :book2_id
+end
diff --git a/activerecord/test/fixtures/db_definitions/schema.rb b/activerecord/test/fixtures/db_definitions/schema.rb
index 9cadc5bdb8..5bde5126d5 100644
--- a/activerecord/test/fixtures/db_definitions/schema.rb
+++ b/activerecord/test/fixtures/db_definitions/schema.rb
@@ -290,6 +290,15 @@ ActiveRecord::Schema.define do
t.column :developer_id, :integer, :null=>false
end
+ create_table :books, :force => true do |t|
+ t.column :name, :string
+ end
+
+ create_table :citations, :force => true do |t|
+ t.column :book1_id, :integer
+ t.column :book2_id, :integer
+ end
+
create_table :inept_wizards, :force => true do |t|
t.column :name, :string, :null => false
t.column :city, :string, :null => false