首页 > 解决方案 > NoMethodError: MinatoBackend::Application:Class 的未定义方法 `parent_name' || Ruby on rail ||

问题描述

我在 Ubuntu 上使用 Ruby on rails。当我迁移数据库时,我收到此错误。

**== 20200722084445 CreateDoorkeeperApplication: migrating ======================
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
undefined method `parent_name' for MinatoBackend::Application:Class
/home/lcongduy/tn-minato/db/migrate/20200722084445_create_doorkeeper_application.rb:3:in `change'
Caused by:
NoMethodError: undefined method `parent_name' for MinatoBackend::Application:Class
/home/lcongduy/tn-minato/db/migrate/20200722084445_create_doorkeeper_application.rb:3:in `change'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)**

这是导致错误的迁移:

class CreateDoorkeeperApplication < ActiveRecord::Migration[6.0]
  def change
    Doorkeeper::Application.create(name: Rails.application.class.parent_name, redirect_uri: "urn:ietf:wg:oauth:2.0:oob", scopes: ["read", "write"])
  end
end

谢谢大家看我的错误。

标签: ruby-on-railsubuntu

解决方案


推荐阅读