Reputation: 51
We developed a site using Rails 3.2.16 and everything was working fine in development and production environments. The problem came when we changed our domain to something like this:
After changing our domain almost every route works ok except root_url, which redirects to:
I have tried to tell Rails what is my domain name by adding this to 'production.rb':
config.action_controller.default_url_options = {
host: 'live.mysite.com.es'
}
But it still gives the same redirection error.
Please let me know if you need more information. Hope you can help me. Thanks.
EDIT:
My routes.rb looks something like this:
MySite::Application.routes.draw do
root :to => 'pages#index'
resource :dashboard do
get "events"
get "products"
...
end
# More resources here.
end
Upvotes: 1
Views: 2319
Reputation: 51
Finally I have been able to find a solution to this problem by adding this to 'production.rb':
config.after_initialize do
Rails.application.routes.default_url_options = {
host: 'com.es',
protocol: 'http',
subdomain: 'live.mysite'
}
end
Thanks everyone!
Upvotes: 4