I've stumbled into this problem, where I'm trying to route my login paths, and I'm trying to achieve
get "/login" => "sessions#new", :as => :login
post "/login" => "sessions#create", :as => :login
lib/action_dispatch/routing/route_set.rb:507:in 'add_route': Invalid route name, already in use: 'login' (ArgumentError)
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 with `resources` as explained here:
resources :sessions, only: [:new, :create], as: :login
This is what I did on my Rails app.
get 'login' => 'sessions#new' post 'login' => 'sessions#create'
I think the
:as => :login part is what is causing your error, I think of that as assigning an alias, and you can't use the same alias for two different routes.