我正在使用Rails 3.有可能是重复的
here.但它没有解决我的问题,也没有任何其他的解决方案.
我的迁移如下
class AddConfirmableToDevise < ActiveRecord::Migration def change change_table(:users) do |t| t.confirmable end add_index :users,:confirmation_token,:unique => true end end
我有设计:确认添加在用户模型.
我的rake db:migrate没有输出.我的注册页面给出错误:
undefined local variable or method 'confirmed_at' for #User
有人有线索吗?
解决方法
好.我解决了迁移过时了.使用相同的代码生成新的迁移,但另一个名称.
运行命令:
rails g migration add_confirmable_to_devise_v1
2.在迁移文件中:
class AddConfirmableToDeviseV1 < ActiveRecord::Migration def change change_table(:users) do |t| t.confirmable end add_index :users,:unique => true end end
3.Then
rake db:migrate