fertech
fertech

Reputation: 41

Rails 3 + Devise error in migration: undefined method timeoutable

I am using rails 3 and Devise 1.3.4 for authentication in my app. After generating the user model, I try to add more devise modules to my devise_create_users.rb migration file, but I get the error:
undefined method `timeoutable' for ActiveRecord::ConnectionAdapters::TableDefinition.

However, adding other modules like :confirmable work just fine.

devise_create_user.rb:

create_table(:users) do |t|
  t.database_authenticatable :null => false
  t.recoverable
  t.rememberable
  t.trackable
  t.timeoutable
  # t.encryptable
  t.confirmable
  # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
  # t.token_authenticatable


  t.timestamps
end

My user model :

class User < ActiveRecord::Base

# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
     :recoverable, :rememberable, :trackable, :validatable, :confirmable , :timeoutable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
end

Any ideas what the error could be?

Upvotes: 4

Views: 2031

Answers (3)

mahemoff
mahemoff

Reputation: 46489

The answer is you don't actually need any migration for timeoutable, it's just a declaration on the user/resource class. See How do I add Devise's 'timeoutable' module to an existing Devise install? - Rails 3.1

Upvotes: 2

rails
rails

Reputation: 11

Do 'rails g devise:install' instead of 'rails g devise install' then migrate db then it should work

Upvotes: 1

Arun Kumar Arjunan
Arun Kumar Arjunan

Reputation: 6857

Did you edit the migration file after running for the first time? Can you please make sure that the users table is having all the columns specified in the devise_create_user.rb

Upvotes: 0

Related Questions