Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Rails4 multi routes config #14338

easyhappy opened this Issue Mar 10, 2014 · 6 comments


None yet
6 participants

I have one Rails3 appliation, and has three routes files, as follow:


In Rails3 application, when add this line to config file

config.paths['config/routes'] += %w{admin books}.map{|path| Rails.root.join("config/routes/#{path}.rb")}

Bug after upgrade to Rails4, this railses error, and I debug tu the source code.
Find that:

initializer :add_routing_paths do |app|
      paths = self.paths["config/routes.rb"].existent

      if routes? || paths.any?
        app.routes_reloader.route_sets << routes

paths['config/routes'] change to paths["config/routes.rb"];

I don't why. @wycats,6acebb3 I find that you did this commit two years ago。
So can you tell me why change paths['config/routes'] to paths["config/routes.rb"] ?


MSch commented Mar 10, 2014

@easyhappy just investigated because I saw we had draw backported in our code base.

I'm pretty sure that happened because wycats' draw feature required paths['config/routes'] to be the directory where the "drawable" routes resided and paths['config/routes.rb'] to be the master route file. When that feature was reverted in 5e7d6bb this change was left (prob. accidentally?)


kaichen commented Mar 10, 2014

That revert commit does not look good.

In feature intro commit, paths['config/routes'] changed to paths['config/routes.rb'], but the revert commit didn't recover it back.

@MSch, Thanks very much.


senny commented Apr 14, 2014

@rails-bot rails-bot added the stale label Aug 19, 2014

This issue has been automatically marked as stale because it has not been commented on for at least
three months.

The resources of the Rails team are limited, and so we are asking for your help.

If you can still reproduce this error on the 4-1-stable, 4-0-stable branches or on master,
please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions.


pixeltrix commented Aug 20, 2014

I'm closing this because I think all you have to do is add the additional paths to the config/routes.rb array in paths and it will work. If it doesn't then let me know and I'll have another look.

@pixeltrix pixeltrix closed this Aug 20, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment