I am using Rails 3. There is a possible duplicate here. But it did not solve my problem, neither did any other solution.
My migration is as follows
class AddConfirmableToDevise < ActiveRecord::Migration
def change
change_table(:users) do |t|
t.confirmable
end
add_index :users, :confirmation_token, :unique => true
end
end
I do have devise :confirmable
added in User
model.
My rake db:migrate
gives no output. and my sign up page gives the error:
undefined local variable or method 'confirmed_at' for #User
Anybody has a clue?
I'm using Mongoid and got this same error. I added these fields and got rspec to go green on my 16 examples.
Note for myself. Someone might find it helpful: What we need is 2 commands below:
Voila! It works!
Ok. I solved it. The migration is outdated. Generate new migration with same code but another name.
1.Run command:
2.In the migration file:
3.Then
To tie in @DevDude's answer with the accepted answer - if you already have an existing
Users
model to which you need to add confirmable, the full migration code for the version of Devise current as of 4/14 is:As of the latest devise, you just need to remove comments from the following lines on the devise users migration.. (2013....._devise_create_users.rb)