ruby-on-rails – 设计迁移不起作用
发布时间:2020-12-16 19:33:11 所属栏目:百科 来源:网络整理
导读:我使用Devise创建了一个User模型,每当我使用rake db:migrate时,我都会遇到以下问题: == DeviseCreateUsers: migrating ==============================================-- create_table(:users)rake aborted!An error has occurred,this and all later mig
我使用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 //循环你的服务器以防万一…… (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |