Saturday, 15 January 2011

How To Recover a Password with Devise ( Ruby on Rails) -



How To Recover a Password with Devise ( Ruby on Rails) -

i'm trying recover user's password devise, generates next error

undefined method `reset_password_sent_at=' #<user:0x007fb78cfafb68>

can help me this, since i'm new ruby on rails?

what best way recover password , email user using devise? give thanks much...

i'm utilize devise (2.2.3)

user.rb

require 'digest/md5' class user < activerecord::base # setup accessible (or protected) attributes model belongs_to :shop before_create :compute_email_md5 # include default devise modules. others available are: # :token_authenticatable, :confirmable, # :lockable, :timeoutable , :omniauthable devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable, :token_authenticatable # setup accessible (or protected) attributes 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

the solution add together reset_password_sent_at column user table

as you've discovered, passord recovery requires model have reset_password_sent_at column. adding via migration should solve problem.

as reason happening, i'm guessing added password recovery (the :recoverable module) after generating devise-enabled model (user). that's why devise's generator didn't create column you.

ruby-on-rails ruby-on-rails-3 devise

No comments:

Post a Comment