4

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?

fertech
  • 41
  • 2

3 Answers3

2

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

Community
  • 1
  • 1
mahemoff
  • 44,526
  • 36
  • 160
  • 222
1

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

rails
  • 11
  • 1
0

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

Arun Kumar Arjunan
  • 6,827
  • 32
  • 35
  • Hi Arun, I edited the file before running any migration. After i got the timeoutable error,I commented out the line and run the migration again. This time it was successful and my table has all the columns for : database_authenticatable, recoverable, rememberable,trackable and confirmable. – fertech Jun 24 '11 at 16:47