本文介绍了#User 的未定义局部变量或方法“confirmed_at"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 Rails 3.可能存在重复的 这里.但它没有解决我的问题,也没有解决任何其他解决方案.
I am using Rails 3. There is a possible duplicate here. But it did not solve my problem, neither did any other solution.
我的迁移如下
class AddConfirmableToDevise < ActiveRecord::Migration def change change_table(:users) do |t| t.confirmable end add_index :users, :confirmation_token, :unique => true end end我确实在 User 模型中添加了 devise :confirmable.
I do have devise :confirmable added in User model.
我的 rake db:migrate 没有输出.我的注册页面出现错误:
My rake db:migrate gives no output. and my sign up page gives the error:
undefined local variable or method 'confirmed_at' for #User有人知道吗?
推荐答案好的.我解决了.迁移已过时.使用相同的代码但不同的名称生成新的迁移.
Ok. I solved it. The migration is outdated. Generate new migration with same code but another name.
1.运行命令:
rails g migration add_confirmable_to_devise_v12.在迁移文件中:
class AddConfirmableToDeviseV1 < ActiveRecord::Migration def change change_table(:users) do |t| t.confirmable end add_index :users, :confirmation_token, :unique => true end end3.然后
rake db:migrate更多推荐
#User 的未定义局部变量或方法“confirmed
发布评论