ruby-on-rails - 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
谢谢大家看我的错误。
解决方案
推荐阅读
- java - 为什么我的 rest api 调用返回未定义的响应
- java - Java ImageIO 类绘制图像并保存为 TIFF
- python - 在 Python 中使用 OpenCV 裁剪错误 - 元组和索引
- node.js - 在 Hapi 中,我如何才能访问 GET 方法的请求有效负载
- regex - 正则表达式捕获一切之后
- python - 如何在 python 中使用 beautifulsoup 替换多个单词(术语),包括 html 标签?
- microsoft-graph-api - 图形作为 PowerShell 的替代品
- excel - 如何根据单独列中的时间值创建移动平均值
- json - 如何在处理 3.4 中加载或导入 url?
- angular - 如何从ngrx商店中的选择中获取错误?