I have a URL like http://myapp.myorg.com/MyApp/one/two
and I want to extract the first part myapp.myorg.com/MyApp/ in the Rails code. Please help me in getting this URL correct.
I'm currently using $servlet_context for this purpose, but it does not give me the result.
My code snippet:
<%= link_to "My Link", "{@hostname}/#{$servlet_context}/three/four" %>
.
This gives me a URL like:
myapp/org.jruby.rack.servlet.ServletRackContext@622209db/three/four
I'm expecting something like:
myapp/MyApp/three/four