Commit cdaa8bda by tady

ancestry gem導入, db migrate

parent d536d37c
class Tag < ActiveRecord::Base class Tag < ActiveRecord::Base
has_many :post_tags has_many :post_tags
has_many :posts, through: :post_tags has_many :posts, through: :post_tags
has_ancestry
end end
class AddAncestryToTags < ActiveRecord::Migration class AddAncestryToTags < ActiveRecord::Migration
def change def change
add_column :tags, :ancestry, :string add_column :tags, :ancestry, :string
add_index :tags, :ancestry
end end
end end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20131130184007) do ActiveRecord::Schema.define(version: 20131213005609) do
create_table "post_tags", force: true do |t| create_table "post_tags", force: true do |t|
t.integer "post_id", null: false t.integer "post_id", null: false
...@@ -35,8 +35,11 @@ ActiveRecord::Schema.define(version: 20131130184007) do ...@@ -35,8 +35,11 @@ ActiveRecord::Schema.define(version: 20131130184007) do
t.string "name" t.string "name"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "ancestry"
end end
add_index "tags", ["ancestry"], name: "index_tags_on_ancestry"
create_table "users", force: true do |t| create_table "users", force: true do |t|
t.string "name" t.string "name"
t.string "image_url" t.string "image_url"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment