当我尝试运行rake db:migrate
时,为什么会显示此错误:
undefined method `to_sym' for {:limit=>30, :string=>"Hint: ", :null=>false}:Hash
代码:
def up
create_table :users do |t|
t.string "email", :limit => 50, :string => "Forgot password!", :null => false
t.column "password", :limit => 30, :string => "Hint: ", :null => false
:default
t.timestamps
end
end
答案 0 :(得分:1)
此行可能需要更改..
t.column "password", :limit => 30, :string => "Hint: ", :null => false
通过
t.string "password", :limit => 30, :string => "Hint: ", :null => false