In my Rails 4 application I have a model that needs to build links to other parts of the application. I am using Rails.application.routes.url_helpers.<path_name>
to generate the URL of this link. The problem I have is that this generated path doesn't included the nested path.
Locally the app is served to localhost:3000
and all the paths work correctly, but when I deploy to a remote server it is served by Nginx/Passenger using the root http://<servername>/admin
and the paths are incorrect. So as an example, what I want is payments_path
to resolve to "/admin/payments"
, but instead I get "/payments"
.
The strange thing is when I use payments_path
directly in my view or other places in my app, I get the path with the nested /admin
path, ie "/admin/payments"
.
Anyone have any idea why path is giving me two different things in the view and the Rails.application.routes.url_helpers
?