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!
精彩评论