Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 10th, 2012  |  syntax: None  |  size: 1.60 KB  |  hits: 49  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Devise `ensure_authentication_token' not working
  2. before_save :ensure_authentication_token
  3.  
  4. devise :database_authenticatable, :registerable,
  5.   :recoverable, :rememberable, :trackable, :validatable
  6.   :token_authenticatable
  7.  
  8. attr_accessible :email, :password, :password_confirmation,
  9.                 :remember_me, :first_name, :last_name,
  10.                 :cell_phone, :city, :state, :country, :user_type
  11.        
  12. config.token_authentication_key = :auth_token
  13.        
  14. class DeviseCreateUsers < ActiveRecord::Migration
  15.   def self.up
  16.    create_table(:users) do |t|
  17.     t.database_authenticatable :null => false
  18.     t.recoverable
  19.     t.rememberable
  20.     t.trackable
  21.     t.token_authenticatable
  22.     t.timestamps
  23.    end
  24.  
  25.    add_index :users, :email,                :unique => true
  26.    add_index :users, :reset_password_token, :unique => true
  27.    add_index :users, :authentication_token, :unique => true
  28.   end
  29.  
  30.   def self.down
  31.    drop_table :users
  32.   end
  33. end
  34.        
  35. {"utf8"=>"✓",
  36.  "authenticity_token"=>"+F8cjCoauVKhZPSJLhW+AAhui1DygBcODsYn4Va/ktY=",
  37.  "user"=>{"first_name"=>"any_name",
  38.  "last_name"=>"any_name",
  39.  "email"=>"any_email@gmail.com",
  40.  "password"=>"[FILTERED]",
  41.  "password_confirmation"=>"[FILTERED]",
  42.  "cell_phone"=>"any_number",
  43.  "city"=>"some_city",
  44.  "state"=>"some_state",
  45.  "country"=>"U.S.A",
  46.  "user_type"=>"student"},
  47.  "commit"=>"Sign up"}
  48.        
  49. NameError in Devise::RegistrationsController#create
  50.  
  51.    undefined local variable or method `ensure_authentication_token' for #<User:0x007fd4448f7350>
  52.        
  53. devise :database_authenticatable, :registerable,
  54.   :recoverable, :rememberable, :trackable, :validatable, #here
  55.   :token_authenticatable