aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/fixtures
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-11-25 22:08:38 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-11-25 22:08:38 +0000
commitf4b5ca1ff0113e41c974b7cbda1f734f9c0526fe (patch)
treea4c8d309f2167c6874954201eb8f864ebdf535c6 /activerecord/test/fixtures
parentea713b6bb9680ef6226761dfc1501f261198723d (diff)
downloadrails-f4b5ca1ff0113e41c974b7cbda1f734f9c0526fe.tar.gz
rails-f4b5ca1ff0113e41c974b7cbda1f734f9c0526fe.tar.bz2
rails-f4b5ca1ff0113e41c974b7cbda1f734f9c0526fe.zip
Fixed that create table with :id => false and fixtures don't play nice together (closes #10154) [jbarnette]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8205 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/fixtures')
-rw-r--r--activerecord/test/fixtures/db_definitions/schema.rb6
-rw-r--r--activerecord/test/fixtures/matey.rb4
-rw-r--r--activerecord/test/fixtures/mateys.yml4
3 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/fixtures/db_definitions/schema.rb b/activerecord/test/fixtures/db_definitions/schema.rb
index 12dbcb8423..9b6b6987d2 100644
--- a/activerecord/test/fixtures/db_definitions/schema.rb
+++ b/activerecord/test/fixtures/db_definitions/schema.rb
@@ -335,4 +335,10 @@ ActiveRecord::Schema.define do
t.column :parrot_id, :integer
t.column :treasure_id, :integer
end
+
+ create_table :mateys, :id => false, :force => true do |t|
+ t.column :pirate_id, :integer
+ t.column :target_id, :integer
+ t.column :weight, :integer
+ end
end
diff --git a/activerecord/test/fixtures/matey.rb b/activerecord/test/fixtures/matey.rb
new file mode 100644
index 0000000000..86442e0470
--- /dev/null
+++ b/activerecord/test/fixtures/matey.rb
@@ -0,0 +1,4 @@
+class Matey < ActiveRecord::Base
+ belongs_to :pirate
+ belongs_to :target, :class_name => 'Pirate', :foreign_key => 'target_id'
+end
diff --git a/activerecord/test/fixtures/mateys.yml b/activerecord/test/fixtures/mateys.yml
new file mode 100644
index 0000000000..9ecdd4ecd5
--- /dev/null
+++ b/activerecord/test/fixtures/mateys.yml
@@ -0,0 +1,4 @@
+blackbeard_to_redbeard:
+ pirate_id: <%= Fixtures.identify(:blackbeard) %>
+ target_id: <%= Fixtures.identify(:redbeard) %>
+ weight: 10