如何在不加载环境的情况下访问Rails应用程序的路由?

时间:2021-03-02 23:49:27

I am trying to access Rails.application.routes in a Capistrano receipt. It's working when requiring Rails and the whole environment require 'config/environment'

我正在试着进入铁路系统。卡皮斯特拉诺收据中的路线。当需要Rails和整个环境需要'config/environment'时,它会工作

Can I require more specific files for accessing the application's routes without loading the environment? It takes so much time to load.

我可以要求更具体的文件来访问应用程序的路由而不加载环境吗?装东西要花很多时间。

Background information:

背景信息:

The directory for storing the picture's cache of the isolated and mounted engine is named like the mount-path:

用于存储孤立和挂载引擎的图片缓存的目录被命名为挂载路径:

/public/myMountedEngine/pictures/...

I want to read the mount-path of the mounted isolated engine for symlinking the nested pictures folder.

我想要读取挂载的独立引擎的安装路径,以便将嵌套的图片文件夹连接起来。

1 个解决方案

#1


2  

You will have to load the config/application.rb at least to get the routes, so you'll get something like this:

您将不得不加载配置/应用程序。rb至少能得到路线,所以你会得到这样的东西:

require "./config/application"
MyApp::Application.routes

#1


2  

You will have to load the config/application.rb at least to get the routes, so you'll get something like this:

您将不得不加载配置/应用程序。rb至少能得到路线,所以你会得到这样的东西:

require "./config/application"
MyApp::Application.routes