修正执行数据迁移时的‘page_type=’ undefine错误

This commit is contained in:
z9hang 2014-07-14 11:28:29 +08:00
parent 98ddd6940d
commit 3aab1b172c
3 changed files with 8 additions and 5 deletions

View File

@ -5,6 +5,7 @@ class CreateFirstPages < ActiveRecord::Migration
t.string :web_title t.string :web_title
t.string :title t.string :title
t.string :description t.string :description
t.string :page_type
t.timestamps t.timestamps
end end
@ -12,6 +13,8 @@ class CreateFirstPages < ActiveRecord::Migration
fp.web_title = "Trustie - 为大学生技术创新筑巢" fp.web_title = "Trustie - 为大学生技术创新筑巢"
fp.title = "Trustie在线项目托管平台" fp.title = "Trustie在线项目托管平台"
fp.description = "面向中国大学生与软件从业者,提供社交化的项目管理、代码托管、资源共享、合作交流。" fp.description = "面向中国大学生与软件从业者,提供社交化的项目管理、代码托管、资源共享、合作交流。"
fp.page_type = "project"
fp.save fp.save
end end
end end

View File

@ -1,9 +1,9 @@
class AddCloumnToFirstPage < ActiveRecord::Migration class AddCloumnToFirstPage < ActiveRecord::Migration
def change def change
add_column :first_pages,:type,:string #add_column :first_pages,:type,:string
fr = FirstPage.all.first #fr = FirstPage.all.first
fr.type = "project" #fr.type = "project"
fr.save #fr.save
end end
end end

View File

@ -1,5 +1,5 @@
class AltColumnName < ActiveRecord::Migration class AltColumnName < ActiveRecord::Migration
def change def change
rename_column :first_pages,:type,:page_type #rename_column :first_pages,:type,:page_type
end end
end end