Skip to content

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

@peteforde

Description

@peteforde

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions