We have an app an upgrading from Rails 3.2 to 4.0.
The 3.2 version has roots
all over routes.rb, which I ported to the new syntax, but I am not quite sure how to handle the subdomain constraint.
In 3.2:
constraints(SubDomain) do
root to: "companies#index"
...
end
I tried to port it like the other root paths, but it looks like there is a conflict on the non-constrained root path.
Here is what I tried:
constraints(SubDomain) do
get "/", to: "companies#index", as: :root
...
end
And the error:
/Users/blu/.rvm/gems/ruby-2.1.7/gems/actionpack-4.0.13/lib/action_dispatch/routing/route_set.rb:430:in
add_route': Invalid route name, already in use: 'root' (ArgumentError) You may have defined two routes with the same name using the
:asoption, 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
resourcesas explained here: http://ift.tt/1g4FQcF from /Users/blu/.rvm/gems/ruby-2.1.7/gems/actionpack-4.0.13/lib/action_dispatch/routing/mapper.rb:1484:in
add_route'
Any help on the correct syntax here would be great, thanks.
Aucun commentaire:
Enregistrer un commentaire