[英]Ruby DB Migration Error 'rake db:migrate'
我开始尝试使用ruby并设置我的开发环境。
我正在参考Ruby on Rails的“入门指南”,然后深入到第5.5节“运行迁移”
问题是当我运行以下命令时
rake db:migrate
我收到以下错误
C:\Users\someuser\RubymineProjects\my_app>rake db:migrate
rake aborted!
SyntaxError:C:/Users/someuser/RubymineProjects/my_app/db/migrate/20140718160751_create_articles.rb:4: syntax error, unexpected '[', expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END
t.string :[title
^
C:/Users/someuser/RubymineProjects/my_app/db/migrate/20140718160751_create_articles.rb:5: syntax error, unexpected ']', expecting keyword_end
t.text] :text
^
C:in `disable_ddl_transaction'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
知道是什么原因造成的,以及如何解决?
看起来您的迁移中有一些不属于您的额外花括号。 迁移应如下所示:
class CreateArticles < ActiveRecord::Migration
def change
create_table :articles do |t|
t.string :title
t.text :text
t.timestamps
end
end
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.