Máme aplikáciu na inováciu od Rails 3.2 až 4.0.
Verzia 3.2 má roots
na celom routes.rb, ktorý som preniesol na novú syntax, ale nie som si celkom istý, ako zvládnuť obmedzenie subdomény.
V 3.2:
constraints(SubDomain) do
root to: "companies#index"
...
end
Snažil som sa to portovať ako ostatné koreňové cesty, ale vyzerá to, že na neriadenej koreňovej ceste existuje konflikt.
Tu je to, čo som skúšal:
constraints(SubDomain) do
get "/", to: "companies#index", as: :root
...
end
A chyba:
/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
zdrojeas explained here: http://guides.rubyonrails.org/routing.html#restricting-the-routes-created from /Users/blu/.rvm/gems/ruby-2.1.7/gems/actionpack-4.0.13/lib/action_dispatch/routing/mapper.rb:1484:in
add_route "
Akákoľvek pomoc na správnej syntaxe tu bude skvelá, vďaka.
odpovede:
0 pre odpoveď č. 1Vyriešte konflikt zadaním iného mena
constraints(SubDomain) do
root :to => "companies#index", :as=> :subdomain_root
...
end