我使用Devise创建了一个User模型,每当我使用rake db:migrate时,我都会遇到以下问题:
== DeviseCreateUsers: migrating ============================================== -- create_table(:users) rake aborted! An error has occurred,this and all later migrations canceled: undefined method `database_authenticatable' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x00000103fa1ff0> Tasks: TOP => db:migrate (See full trace by running task with --trace)
我使用–trace函数运行完整的跟踪,但似乎无法弄清楚问题是什么.
这是迁移文件:
class DeviseCreateUsers < ActiveRecord::Migration def self.up create_table(:users) do |t| t.database_authenticatable :null => false t.recoverable t.rememberable t.trackable t.confirmable # t.encryptable # t.lockable :lock_strategy => :Failed_attempts,:unlock_strategy => :both # t.token_authenticatable t.timestamps end add_index :users,:email,:unique => true add_index :users,:reset_password_token,:confirmation_token,:unique => true # add_index :users,:unlock_token,:authentication_token,:unique => true end def self.down drop_table :users end end