Nuevo en todos los mundos de codificación y nuevo en RoR. He estado haciendo un tutorial y me encontré con algunos problemas anoche. Un amigo mío ayudó con algunos de ellos. Pregunté algunos aquí. Y sin embargo, este me desconcierta. No puedo encontrar el problema.Ninguna ruta coincide con "/ índice". ¿Problema simple?
La página se carga, muestra lo que se debe mostrar. Pero cuando se presiona un enlace en no da lugar a esto:
Routing Error
No route matches "/index"
así lo hice rake routes
y me dieron esta
Dennis-Buizerts-MacBook-Pro:gpoff dennisbuizert$ rake routes
site_index GET /site/index(.:format) {:controller=>"site", :action=>"index"}
site_about GET /site/about(.:format) {:controller=>"site", :action=>"about"}
site_help GET /site/help(.:format) {:controller=>"site", :action=>"help"}
root /(.:format) {:controller=>"Site", :action=>"index"}
Esto está en mi routes.rb
root :to => "Site#index"
get "site/index"
get "site/about"
get "site/help"
I intenté agregar map.connects
y match
pero eso no pareció resolverlo. Y mi development.log dice la siguiente manera:
Started GET "/" for 127.0.0.1 at 2011-08-28 10:05:51 +0200
DEPRECATION WARNING: Disabling sessions for a single controller has been deprecated. Sessions are now lazy loaded. So if you don't access them, consider them off. You can still modify the session cookie options with request.session_options. (called from <class:ApplicationController> at /Users/dennisbuizert/Sites/gpoff/app/controllers/application_controller.rb:3)
Processing by SiteController#index as HTML
Rendered site/index.html.erb within layouts/application (1.6ms)
Completed 200 OK in 5ms (Views: 4.3ms | ActiveRecord: 0.0ms)
Started GET "/index" for 127.0.0.1 at 2011-08-28 10:05:52 +0200
ActionController::RoutingError (No route matches "/index"):
Rendered /Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.8ms)
Si nadie publica una respuesta, puede intentar [http: // webdevrefinery. com /] (http://webdevrefinery.com/). Hay un grupo de acólitos de RoR que rondan por allí a horas extrañas. –
Gracias lo tendré en cuenta. – dbuizert
¿Cómo se crea este enlace a '/ index'? Porque la raíz no debe ser '/ index' sino simplemente'/'. – nathanvda