Mr Sooul
Mr Sooul

Reputation: 699

Rails additional configuration in initializer

I want to use additional route files in my app, so when I add

config.paths['config/routes'] = Dir[Rails.root.join('config/routes/*.rb')]

to my config/application.rb file everything is fine.

The problem occurs, when I try to place this code in my initializer:

MyApp::Application.config.paths['config/routes'] = Dir[Rails.root.join('config/routes/*.rb')]

I check it in the rails console - MyApp::Application.config.paths hold proper path, but it seems that files from config/routes won't load.

How can I resolve this problem?

I'm using Rails 3.2.6.

Upvotes: 0

Views: 149

Answers (1)

deefour
deefour

Reputation: 35370

Not answering your question directly, but providing a different (better?) approach to what you're trying to do:

Check out this alternative that DHH posted in a gist.

Upvotes: 1

Related Questions