Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 4 router doesn't support identically named routes with conditional logic #39

Open
peteforde opened this issue Jun 5, 2013 · 6 comments

Comments

@peteforde
Copy link

ArgumentError - 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.

The issue is this suggested code:

authenticated :user do
  root :to => 'users#index'
end
root :to => 'home#index'

I got my routes working by adding a named route:

authenticated :user do
  root :to => 'users#index', as: :authenticated_root
end
root :to => 'home#index'

There is a change in Rails 4 which has been acknowledged by the core team:

heartcombo/devise#2393

@DazDotOne
Copy link

+1 thanks for the temporary fix

@timvenn20183
Copy link

Thanks.

@coorasse
Copy link

coorasse commented May 7, 2014

+1 thanks for fix

@pazaricha
Copy link

👍 Thanks!

@stefanhendriks
Copy link

looks like still this is needed, thanks for the suggested 'fix' 👍

@DanielKehoe
Copy link
Member

I'm no longer recommending or supporting this application. Please use
https://github.com/RailsApps/rails-devise-roles
or
https://github.com/RailsApps/rails-devise-pundit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants