【发布时间】:2013-04-24 20:28:45
【问题描述】:
我正在尝试在我的迁移中创建记录,但我遇到了问题,我以前做过(在我的高级开发人员的帮助下),我试图复制他所做的,但它似乎没有在数据库...
这是迁移文件
class PageEditor < ActiveRecord::Base; end
def create_initial_record
PageEditor.create({
:title => 'Events & Training',
:content => ''
})
PageEditor.create({
:title => 'Roof Mount - Training',
:content => ''
})
end
class CreatePageEditors < ActiveRecord::Migration
def up
create_table :page_editors do |t|
t.string :title
t.text :content
t.timestamps
end
create_initial_record
end
def down
drop_table :page_editors
end
end
所以我添加了屋顶安装 - 训练部分,然后运行了 rake db:migrate 但它不会创建记录并且不会显示在我的索引页面上......
【问题讨论】:
-
我觉得我正在做与您提到的帖子相同的事情,但由于某种原因它没有添加该字段.....任何帮助将不胜感激
标签: ruby-on-rails ruby ruby-on-rails-3