Why would my rails routes suddenly work differently?
I have a VPS with a hosting provider, and recently they decided to upgrade their server hardware and change virtualization software. Since that happened, I've suddenly had a problem with one of my routes in my Rails application. Nothing in my code should have changed (and didn't, as far as I can tell), and all the gems I use (including Rails) are vendored.
The problem seems to be stemming from the fact that I have an admin/journal
controller and an admin/journal/export
controller. Previously, my routing was working like so:
>> r = ActionController::Routing::Routes
=> ...
>> r.recognize_path "/admin/journal/export/run"
=> {:controller=>"admin/journal/export", :action=>"run"}
However, since the migration, my routing is working as follows:
>> r = ActionController::Routing::Routes
=> ...
>> r.recognize_path "/admin/journal/export/run"
=> {:controller=>"admin/journal", :action=>"export", :id=>"run"}
开发者_StackOverflow社区
I traced the problem to the default route map.connect ':controller/:action/:id'
, and commenting out that route will make my routing work again. However, that route has existed in my routing file since the beginning of my application and never caused a problem before (I tried it in my development environment and it works fine there too).
Can anyone think of any reason why routing would suddenly not recognize admin/journal/export
as the right controller?
The ordering of routes is quite significant, so that's where I'd start... but if you say the code hasn't changed then you might want to just chalk it up to gremlins :)
Did the the version of Ruby change, by any chance? 1.8.6
-> 1.8.7
has caused me some odd problems before.
精彩评论