Namespace routes aren't working
I have a route which looks something like this:
map.namespace :a do |a|
a.namespace :b do |b|
b.connect ':controller/:action'
end
end
I have a folder app/controllers/a/b which stores different controller files, all exist within a A::B
module.
This route works well on my local machine but it doesn't work on the server I'm deploying to.
When I try to browse to, for instance, http://mysite.com/a/b/cont/act I get an error that the controller b
with action cont
and id act
is not found...
I'm using Rails 2.3.5 with Ruby 1.8.7 and my server runs nginx 0.7.64 with Passenger 2.2.8.
Any idea?
By the way, if I'm adding a full route, somethi开发者_C百科ng like:
map.connect 'a/b/cont/:action', :controller => 'a/b/cont'
then it works...
After a few hours I solved it!
It turned out there was an AController controller class under folder a. This messed up rails, which tried to look after an action within this class and didn't even try to look inside folder B... Renaming AController to ALogicController fixed the problem.
I still don't know why it happens on this server and not on my local machine, though.
精彩评论