Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

enter image description here

like image 217
Shreya Choubey Avatar asked Sep 17 '25 01:09

Shreya Choubey


2 Answers

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
like image 134
Ganesh Avatar answered Sep 19 '25 09:09

Ganesh


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.

like image 38
thrgamon Avatar answered Sep 19 '25 07:09

thrgamon