From 8b3f83105ce719642a8f079f72c4f03c97cfc321 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 26 Nov 2007 22:45:43 +0000 Subject: Foxy fixtures: allow mixed usage to make migration easier and more attractive. Closes #10004. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8218 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/fixtures/db_definitions/schema.rb | 10 +++++++++- activerecord/test/fixtures/joke.rb | 3 --- activerecord/test/fixtures/matey.rb | 2 +- activerecord/test/fixtures/parrots.yml | 5 +++++ activerecord/test/fixtures/ship.rb | 3 +++ activerecord/test/fixtures/ships.yml | 5 +++++ 6 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 activerecord/test/fixtures/ship.rb create mode 100644 activerecord/test/fixtures/ships.yml (limited to 'activerecord/test/fixtures') diff --git a/activerecord/test/fixtures/db_definitions/schema.rb b/activerecord/test/fixtures/db_definitions/schema.rb index 9b6b6987d2..f6bd0efa5d 100644 --- a/activerecord/test/fixtures/db_definitions/schema.rb +++ b/activerecord/test/fixtures/db_definitions/schema.rb @@ -335,10 +335,18 @@ 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 + + create_table :ships, :force => true do |t| + t.string :name + t.datetime :created_at + t.datetime :created_on + t.datetime :updated_at + t.datetime :updated_on + end end diff --git a/activerecord/test/fixtures/joke.rb b/activerecord/test/fixtures/joke.rb index 8006a43bd7..3978abc2ba 100644 --- a/activerecord/test/fixtures/joke.rb +++ b/activerecord/test/fixtures/joke.rb @@ -1,6 +1,3 @@ class Joke < ActiveRecord::Base set_table_name 'funny_jokes' end -class Joke < ActiveRecord::Base - set_table_name 'funny_jokes' -end \ No newline at end of file diff --git a/activerecord/test/fixtures/matey.rb b/activerecord/test/fixtures/matey.rb index 86442e0470..47b0baa974 100644 --- a/activerecord/test/fixtures/matey.rb +++ b/activerecord/test/fixtures/matey.rb @@ -1,4 +1,4 @@ class Matey < ActiveRecord::Base belongs_to :pirate - belongs_to :target, :class_name => 'Pirate', :foreign_key => 'target_id' + belongs_to :target, :class_name => 'Pirate' end diff --git a/activerecord/test/fixtures/parrots.yml b/activerecord/test/fixtures/parrots.yml index 74bc6b4e78..dd2c9548e7 100644 --- a/activerecord/test/fixtures/parrots.yml +++ b/activerecord/test/fixtures/parrots.yml @@ -9,6 +9,11 @@ louis: frederick: name: $LABEL +polly: + id: 4 + name: $LABEL + treasures: sapphire, ruby + DEFAULTS: &DEFAULTS treasures: sapphire, ruby diff --git a/activerecord/test/fixtures/ship.rb b/activerecord/test/fixtures/ship.rb new file mode 100644 index 0000000000..05b09fc1b9 --- /dev/null +++ b/activerecord/test/fixtures/ship.rb @@ -0,0 +1,3 @@ +class Ship < ActiveRecord::Base + self.record_timestamps = false +end \ No newline at end of file diff --git a/activerecord/test/fixtures/ships.yml b/activerecord/test/fixtures/ships.yml new file mode 100644 index 0000000000..137055aad1 --- /dev/null +++ b/activerecord/test/fixtures/ships.yml @@ -0,0 +1,5 @@ +black_pearl: + name: "Black Pearl" +interceptor: + id: 2 + name: "Interceptor" -- cgit v1.2.3