Quisiera crear dos rutas root
, una para los usuarios autenticados y otra para los que no lo están; para esto utilizo devise, probé con el siguiente código pero me da error.
Error
Invalid route name, already in use: 'root' You may have defined two routes with the same name using the
:as
option, or you may be overriding a route already defined by a resource with the same naming. For the latter, you can restrict the routes created withresources
as explained here: http://guides.rubyonrails.org/routing.html#restricting-the-routes-created
routes.rb
Rails.application.routes.draw do
devise_for :users
authenticated :user do
root 'main#home'
end
unauthenticated :user do
root 'main#unregistered'
end
end
main_controller
class MainController < ApplicationController
def home
end
def unregistered
end
end