开发者

Rails 2.3.8: namespace + default route (server-dependent routing issue)

开发者 https://www.devze.com 2023-01-13 13:37 出处:网络
I开发者_Go百科 have FriendshipRequests controller under controllers/users/ namespace. The problem appeared after setting up stage server: same url is processed different locally and on the stage.

I开发者_Go百科 have FriendshipRequests controller under controllers/users/ namespace. The problem appeared after setting up stage server: same url is processed different locally and on the stage.

locally (mac os X, ruby 1.8.7p174, frozen rails 2.3.8, rack 1.1.0)

/users/friendship_requests/accept?req_id=3

routes to

Processing Users::FriendshipRequestsController#index (for 127.0.0.1 at 2010-08-30 19:55:56) [GET]

Parameters: {"action"=>"index", "notice"=>"Friendship was accepted.", "controller"=>"users/friendship_requests"}

On the stage server (Debian Linux 2.6.21.7-2.fc8xen-ec2-v1.0 #1 SMP Tue Sep 1 10:25:30 EDT 2009 x86_64 GNU/Linux, ruby 1.8.7p302, rack 1.1.0)

the same url routes to

Processing UsersController#friendship_requests (for 119.170.16.22 at 2010-08-30 16:18:41) [GET]

Parameters: {"action"=>"friendship_requests", "id"=>"accept", "controller"=>"users", "req_id"=>"3"}

Problem could be solved by adding map.connect 'users/friendship_requests/:action/:id', :controller => 'users/friendship_requests' to config/routes, but I want to know causes of the problem.

Both instances are running under latest nginx passenger. Running locally under production environment nade no difference.

Thanks!


Since you are going from Mac to Linux, I would suspect there's some sort of case-sensitivity issue. Maybe try running rake routes on both platforms and then compare the output.


You could investigate the different ruby versions you use on stage (ruby 1.8.7p302) and on local (ruby 1.8.7p174) machine. And as fullware mentioned Mac nad Linux could be the cause to. You never know...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号