This project is archived and is in readonly mode.
Dispatcher interprets path separators in controller names as nested modules/namespaces whether you like it or not.
-
Ranjeet Smith
I should add that in previous versions of Rails it was possible to simply append these subdirectories to config.load_paths and have their contents treated as regular, non-namespaced controllers. 2.3 breaks this capability.
-
Matt Jones
I just tested this on 2.2.2, and it doesn't work unless both config.load_paths and config.controller_paths have the subdirectory added to them. Without the load_paths, the controller definition wasn't found; and without the controller_paths the route wouldn't resolve. Identical behavior on 2.3 edge.
@Ranjeet - when (what version) did this work in the way you've described? Can you write a test that passes on 2.2.2 but not 2.3? Either a test or a sample app that demonstrates the behavior would be very helpful.
-
Zyclops
The following does the trick for me. I don't know whether this is worth building into rails?
config.load_paths += Dir["#{RAILS_ROOT}/app/models/**/*"].find_all { |f| File.stat(f).directory? } config.load_paths += Dir["#{RAILS_ROOT}/app/controllers/**/*"].find_all { |f| File.stat(f).directory? } config.controller_paths += Dir["#{RAILS_ROOT}/app/controllers/**/*"].find_all { |f| File.stat(f).directory? } -
Santiago Pastorino
- State changed from new to open
- Importance changed from to
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 core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino
- State changed from open to stale