Robin
Robin

Reputation: 915

How do I access routes of Rails application without loading the environment?

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'

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.

Upvotes: 3

Views: 220

Answers (1)

Federico Builes
Federico Builes

Reputation: 5107

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

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

Upvotes: 2

Related Questions