简体   繁体   中英

undefined local variable or method `locked_at' for #<User:0x007f28a2101568> Did you mean? lock_access

So I have made a project in ruby on rails for authentication using devise and facebook. While logging in through devise simple sign up I am getting this error of:

undefined local variable or method `locked_at' for # Did you mean? lock_access!

在此处输入图片说明

I think locked_at column were not added for users table

generate migration for adding column in users table

  def change
    add_column :users, :locked_at, :datetime
  end

For those who are coming here from Google like me, you may want to also heed this line in the Devise getting started README - https://github.com/plataformatec/devise#getting-started

Next, check the MODEL for any additional configuration options you might want to add, such as confirmable or lockable. If you add an option, be sure to inspect the migration file (created by the generator if your ORM supports them) and uncomment the appropriate section. For example, if you add the confirmable option in the model, you'll need to uncomment the Confirmable section in the migration.

Double check your Devise users migration file ( db/migrate/TIMESTAMP_devise_create_users.rb ) and uncomment any of the necessary sections. In this case, the sections relating to the Lockable module.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM