Rails url helpers in subdomains - remove the subdomain

ruby-on-rails, ruby-on-rails-3

Solution

First suggestion was using path helper instead of user helper, but editing that as I don't think that helps.

Have you tried root_url(:host => request.domain) to lose the subdomain, instead of your approach? I got that from here: https://github.com/rails/rails/issues/2025

Problem

A user on my site can have a subdomain. So for example, their page url is ``` name.example.com ``` Logged in users are able to view more user information so on the user's show page, I have a link that is generated with the following code: ``` user_url(@user, :subdomain => false) ``` This link should generate the following url (where @user has an ID of 19) ``` example.com/users/19 ``` When I hover over the link, all looks good (i.e., in the bottom of the browser window, both Safari and FF show the link correctly.) Problem is when I click the link, the site raises a 404 and the url is: ``` example.com/users/19 ``` Anyone know what happened to the slash between com and users and how do I get it back? BTW, Rails 3.2 and everything works in development. This issue only arises in production.

Original source