ruby-on-rails – 未定义的局部变量或#User的“confirmation_at”方法

我正在使用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

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...