ruby-on-rails – 设计迁移不起作用

我使用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

解决方法

很高兴听到.
我想官方的答案是重新运行这些步骤:

rails g devise:安装

rails g设计用户

rake db:migrate

rails s //循环你的服务器以防万一……

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...