undefined local variable or method `confirmed_at' for #User

后端 未结 5 1112
一个人的身影
一个人的身影 2021-01-31 10:43

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         


        
5条回答
  •  被撕碎了的回忆
    2021-01-31 11:12

    Ok. I solved it. The migration is outdated. Generate new migration with same code but another name.

    1.Run command:

    rails g migration add_confirmable_to_devise_v1
    

    2.In the migration file:

    class AddConfirmableToDeviseV1 < ActiveRecord::Migration
      def change
        change_table(:users) do |t| 
          t.confirmable 
        end
        add_index  :users, :confirmation_token, :unique => true 
      end
    end
    

    3.Then

    rake db:migrate
    

提交回复
热议问题