Reputation: 6639
Windows 8.1 Rails 4.1 Ruby 2.0.0
This is what I have in my user.rb (model):
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:password_expirable, :confirmable, :lockable, :timeoutable
if :work_phone != nil
phony_normalize :work_phone, :default_country_code => 'US'
end
if :mobile_phone != nil
phony_normalize :mobile_phone, :default_country_code => 'US'
end
if :fax_phone != nil
phony_normalize :fax_phone, :default_country_code => 'US'
end
if :other_phone != nil
phony_normalize :other_phone, :default_country_code => 'US'
end
validates :first, presence: true
validates :last, presence: true
validates :organization, presence: true
validates_plausible_phone :work_phone
validates_plausible_phone :mobile_phone
validates_plausible_phone :fax_phone
validates_plausible_phone :other_phone
validates :email, :email => true, presence: true, uniqueness: {case_sensitive: false}
before_save { |user| user.email = email.downcase }
end
and this is what I have in my seeds.rb:
user = User.new(
:email =>'[email protected]',
:password =>'Vb%69Krn#',
:password_confirmation =>'Vb%69Krn#',
:first =>'John',
:last =>'Doe',
:salutation =>'Doe',
:organization =>'Doe Test',
:work_phone =>'555-555-5555',
:mobile_phone =>'555-555-5555',
:fax_phone =>'555-555-5555',
:other_phone =>'555-555-5555',
:address1 =>'One Main Street',
:city =>'Anytown',
:state =>'WA',
:zip =>'98011',
:role =>'admin'
)
user.skip_confirmation!
user.save
When I do rake db:seed, I get the following error message:
rake aborted!
NoMethodError: undefined method `password_changed_at_changed?' for #<User:0x00000005f2b458>
C:/projects/rails/doe/db/seeds.rb:27:in `<top (required)>'
-e:1:in `load'
-e:1:in `<main>'
Tasks: TOP => db:seed
Any ideas?
Upvotes: 1
Views: 293
Reputation: 7230
This is a a problem with devise_security_extension. You have setted password_expirable
but you probably didn't do this :
create_table :the_resources do |t|
# other devise fields
t.datetime :password_changed_at
end
add_index :the_resources, :password_changed_at
As it said in the documentation.
Upvotes: 1