我正在尝试使用 devise 恢复用户的密码,但它会生成以下错误
undefined method `reset_password_sent_at=' for #<User:0x007fb78cfafb68>
任何人都可以帮我解决这个问题,因为我是 Ruby on Rails 的新手?
使用 Devise 恢复密码并向用户发送电子邮件的最佳方法是什么?非常感谢你...
我正在使用设计(2.2.3)
User.rb
require 'digest/md5'
class User < ActiveRecord::Base
# Setup accessible (or protected) attributes for your model
belongs_to :shop
before_create :compute_email_md5
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable,
:recoverable,
:rememberable,
:trackable,
:validatable,
:token_authenticatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email,
:email_md5,
:password,
:password_confirmation,
:shop_id,
:role,
:terms,
:name,
:notify_on_order_received
validates :terms, :acceptance => true, :on => :create
end
解决方案是将 reset_password_sent_at 列添加到用户表