I've got the following in my routes file:
scope :constraints => lambda{ |req| req.session[:user_id].present? } do
root "users#show"
end
scope :constraints => lambda{ |req| req.session[:admin_id].present? } do
root "brands#index"
end
root "sessions#new"
This code worked fine in Rails 3, but when I use it in Rails 4 I get the following error message:
Invalid route name, already in use 'root' (ArgumentError).
You may have defined two routes with the same name using the ':as' option
Is there a way round this? What has changed?