【问题标题】:Devise token auth preventing migration设计令牌身份验证防止迁移
【发布时间】:2016-11-20 12:51:01
【问题描述】:

我的 rails 应用正在使用 Devise。我添加了 devise_token_auth,以便我可以将应用程序链接到 android 应用程序。

在路线中

namespace :api do
scope :v1 do
  #mount_devise_token_auth_for 'User', at: 'auth'
end
end

在初始化器中

# enable_standard_devise_support = false #for working with Devise

(除了文件中的其他代码)

我收到了这个错误

:~/workspace (master) $ rake db:migrate
-- [](4.2)
-- [](4.2)
rake aborted!
NoMethodError: undefined method `[]' for #<ActiveRecord::Migration:0x00000002c3c470>

解决方法,我删除修改了迁移文件

class DeviseTokenAuthCreateUsers < ActiveRecord::Migration[4.2]

class DeviseTokenAuthCreateUsers < ActiveRecord::Migration

我停止收到错误,但现在我收到了这个

StandardError: An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: table "users" already exists: CREATE TABLE "users" ("id" IN ........

请帮忙,我怎样才能让它工作?

【问题讨论】:

    标签: ruby-on-rails authentication devise token


    【解决方案1】:

    尝试以下步骤:

    rake db:drop
    rake db:create
    rake db:migrate
    

    【讨论】:

      猜你喜欢
      • 2012-06-04
      • 2011-06-07
      • 2017-01-01
      • 2016-05-08
      • 2015-02-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-08
      相关资源
      最近更新 更多