且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Rails:有 Engine.root 吗?

更新时间:2023-02-20 10:39:06

假设你的引擎文件是这样设置的:

Lets say your engine file is set up like this:

module MyEngine
  class Engine < Rails::Engine
    #......
  end
end

您可以像这样在 Engine 类上调用 root:

You can call root on the Engine class like this:

MyEngine::Engine.root