开发者

Rails map.root problem redirecting to incorrect URL

开发者 https://www.devze.com 2022-12-15 06:50 出处:网络
I have a Rails app that is deployed on a machine but not to the root of that machine using Passenger (i.e. RailsBaseURI /myapp).I\'ve tried to set up map.root to point to one of my controllers in the

I have a Rails app that is deployed on a machine but not to the root of that machine using Passenger (i.e. RailsBaseURI /myapp). I've tried to set up map.root to point to one of my controllers in the routes:

map.root :controller => :target

and it's redirecting, but not to the right place. Instead of going to www.mymachine.com/myapp/target,开发者_开发百科 it's going to www.mymachine.com/target, which is not correct. I'm not sure what I'm missing, but it seems like it must be something obvious.


You can set ENV['RAILS_RELATIVE_URL_ROOT'] = 'myapp' in your configuration.

Also, you can use map.root :controller => :target, :path_prefix => 'myapp'

The later approach need to be done for each resource, while the first one applies to all!

0

精彩评论

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