Is there any way to define different root url based on Rails environment. I want to set root :to => 'pages#index'
for development and staging environment and root :to => 'beta_pages#index'
for production environment.
Thanks in advance.
Yes, you can do that.
In your routes.rb
file:
if Rails.env.development? || Rails.env.staging?
root :to => 'pages#index'
elsif Rails.env.production?
root :to => 'beta_pages#index'
end