diff options
Diffstat (limited to 'activerecord/test/fixtures')
-rw-r--r-- | activerecord/test/fixtures/db_definitions/schema.rb | 13 | ||||
-rw-r--r-- | activerecord/test/fixtures/post.rb | 4 | ||||
-rw-r--r-- | activerecord/test/fixtures/tag.rb | 2 | ||||
-rw-r--r-- | activerecord/test/fixtures/tagging.rb | 4 | ||||
-rw-r--r-- | activerecord/test/fixtures/taggings.yml | 5 | ||||
-rw-r--r-- | activerecord/test/fixtures/tags.yml | 3 |
6 files changed, 30 insertions, 1 deletions
diff --git a/activerecord/test/fixtures/db_definitions/schema.rb b/activerecord/test/fixtures/db_definitions/schema.rb new file mode 100644 index 0000000000..b839edbac0 --- /dev/null +++ b/activerecord/test/fixtures/db_definitions/schema.rb @@ -0,0 +1,13 @@ +ActiveRecord::Schema.define do + + create_table "taggings", :force => true do |t| + t.column "tag_id", :integer + t.column "taggable_type", :string + t.column "taggable_id", :integer + end + + create_table "tags", :force => true do |t| + t.column "name", :string + end + +end
\ No newline at end of file diff --git a/activerecord/test/fixtures/post.rb b/activerecord/test/fixtures/post.rb index bf44d8a0a5..61249c43e0 100644 --- a/activerecord/test/fixtures/post.rb +++ b/activerecord/test/fixtures/post.rb @@ -19,7 +19,9 @@ class Post < ActiveRecord::Base has_and_belongs_to_many :categories has_and_belongs_to_many :special_categories, :join_table => "categories_posts" - + + has_many :taggings, :as => :taggable + def self.what_are_you 'a post...' end diff --git a/activerecord/test/fixtures/tag.rb b/activerecord/test/fixtures/tag.rb new file mode 100644 index 0000000000..bfd81c69f7 --- /dev/null +++ b/activerecord/test/fixtures/tag.rb @@ -0,0 +1,2 @@ +class Tag < ActiveRecord::Base +end
\ No newline at end of file diff --git a/activerecord/test/fixtures/tagging.rb b/activerecord/test/fixtures/tagging.rb new file mode 100644 index 0000000000..06d0144b5a --- /dev/null +++ b/activerecord/test/fixtures/tagging.rb @@ -0,0 +1,4 @@ +class Tagging < ActiveRecord::Base + belongs_to :tag + belongs_to :taggable, :polymorphic => true +end
\ No newline at end of file diff --git a/activerecord/test/fixtures/taggings.yml b/activerecord/test/fixtures/taggings.yml new file mode 100644 index 0000000000..ca171346f1 --- /dev/null +++ b/activerecord/test/fixtures/taggings.yml @@ -0,0 +1,5 @@ +welcome_general: + id: 1 + tag_id: 1 + taggable_id: 1 + taggable_type: Post diff --git a/activerecord/test/fixtures/tags.yml b/activerecord/test/fixtures/tags.yml new file mode 100644 index 0000000000..2a494089ff --- /dev/null +++ b/activerecord/test/fixtures/tags.yml @@ -0,0 +1,3 @@ +general: + id: 1 + name: General
\ No newline at end of file |