How to make Devise lockable with number of failed attempts

Devise needs these three attributes on your model. Therefore, generate the following migration and run it.

class AddLockableToExamples < ActiveRecord::Migration
  def change
    add_column :examples, :failed_attempts, :integer, default: 0
    add_column :examples, :unlock_token, :string # Only if unlock strategy is :email or :both
    add_column :examples, :locked_at, :datetime
  end
end

Hope this saves someone else hours of google-fu.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)