title: Rails Devise confirmable error
body: <p>Currently trying to integrate a confirmation mail with devise authentication. I followed the instruction's from the devise documentation: </p>
  
  <p><a href="https://github.com/plataformatec/devise/wiki/How-To:-Add-:confirmable-to-Users" rel="nofollow noreferrer">https://github.com/plataformatec/devise/wiki/How-To:-Add-:confirmable-to-Users</a></p>
  
  <p>When i try to sign up a new user i get the following error: </p>
  
  <pre><code>NameError in Devise::RegistrationsController#create
  undefined local variable or method `confirmed_at' for #&lt;User:0x9b87b38&gt;
  </code></pre>
  
  <p><strong>User.rb</strong></p>
  
  <pre><code>  class User &lt; ActiveRecord::Base
    # Include default devise modules. Others available are:
    # :confirmable, :lockable, :timeoutable and :omniauthable
  
  
  
    devise :database_authenticatable, :registerable,
           :recoverable, :rememberable, :trackable, :validatable, :confirmable
  end
  </code></pre>
  
  <p><strong>rails g migration add_confirmable_to_devise</strong></p>
  
  <pre><code>    class AddConfirmableToDevise &lt; ActiveRecord::Migration
    # Note: You can't use change, as User.update_all will fail in the down migration
    def up
      add_column :users, :confirmation_token, :string
      add_column :users, :confirmed_at, :datetime
      add_column :users, :confirmation_sent_at, :datetime
      # add_column :users, :unconfirmed_email, :string # Only if using reconfirmable
      add_index :users, :confirmation_token, unique: true
      # User.reset_column_information # Need for some types of updates, but not for update_all.
      # To avoid a short time window between running the migration and updating all existing
      # users as confirmed, do the following
      execute("UPDATE users SET confirmed_at = NOW()")
      # All existing user accounts should be able to log in after this.
      # Remind: Rails using SQLite as default. And SQLite has no such function :NOW.
      # Use :date('now') instead of :NOW when using SQLite.
      # =&gt; execute("UPDATE users SET confirmed_at = date('now')")
      # Or =&gt; User.all.update_all confirmed_at: Time.now
    end
  
    def down
      remove_columns :users, :confirmation_token, :confirmed_at, :confirmation_sent_at
      # remove_columns :users, :unconfirmed_email # Only if using reconfirmable
    end
  end
  </code></pre>
  
  <p><strong>confirmations_controller.rb</strong></p>
  
  <pre><code>class ConfirmationsController &lt; Devise::ConfirmationsController
    private
    def after_confirmation_path_for(resource_name, resource)
      your_new_after_confirmation_path
    end
  end
  </code></pre>
  
  <p><strong>routes.rb</strong></p>
  
  <pre><code>Rails.application.routes.draw do
    devise_for :users, controllers:{ confirmations: 'confirmations'}
    resources :videos
    get 'welcome/index'
  
    get 'welcome/new'
  
    root 'welcome#index'
  
  
  
  end
  </code></pre>
  
  <p>I also saw someone saying i should add gem 'simple_token_authentication to my Gemfile and run </p>
  
  <pre><code>    rails g migration add_authentication_token_to_users authentication_token:string:index
  rake db:migrate
  </code></pre>
  
  <p>However, that didn't fix that problem. </p>
  
  <p>Any ideas? Thanks!</p>