我使用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 //循环你的服务器以防万一……
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。