插件在管理页面引发异常错误——无法在没有 ID 的情况下对插件进行实例化

你好,

我在创建插件时遇到了以下错误:

错误:无法在没有 `id` 的情况下对插件进行水合
    在 Class._hydrate (discourse/models/store:330)
    在 eval (discourse/models/store:222)
    在 Array.map (<anonymous>)
    在 Class._resultSet (discourse/models/store:221)
    在 eval (discourse/models/store:80)
    在 tryCatcher (ember:61303)
    在 invokeCallback (ember:61476)
    在 publish (ember:61462)
    在 eval (ember:55822)
    在 invoke (ember:54023)

我想请问,这里的 id 指的是什么?
该错误仅在我导航到 /admin 并进入插件页面时出现在控制台中。
还需要哪些其他信息来调试此错误?

您安装了哪个插件?

这是我们目前正在开发的一个项目。一旦获得开源许可,我会立即发布相关链接。

我们找到问题了。如果导航到 /admin/plugins.json,我们会发现通常由插件名称填充的插件 ID 并未设置。

原来,这些字段是通过在 plugin.rb 文件中添加一段注释来填充的……因此修复方法就是添加以下内容:

# frozen_string_literal: true
# name: example
# about: example about
# version: 1.0
# authors: example 
# url: example

我觉得,如果要求文件中的注释,应该 somewhere 有明确的文档说明……所以我把这个解决方案留在这里。