Mới cho tất cả các thế giới mã hóa và mới đối với RoR. Tôi đã làm một hướng dẫn và chạy vào một số vấn đề tối qua. Một người bạn của tôi đã giúp với một vài người trong số họ. Tôi hỏi một vài ở đây. Và điều này đã ngăn cản tôi. Tôi không thể tìm thấy vấn đề của nó.Không có tuyến đường phù hợp "/ chỉ mục". Vấn đề đơn giản?
Trang tải, nó hiển thị những gì cần được hiển thị. Nhưng khi tôi nhấn một liên kết trên có nó kết quả trong này:
Routing Error
No route matches "/index"
Vì vậy, tôi đã làm rake routes
và tôi đã nhận này
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"}
Đây là trong routes.rb tôi
root :to => "Site#index"
get "site/index"
get "site/about"
get "site/help"
tôi đã thử thêm map.connects
và match
nhưng điều đó dường như không giải quyết được. Và development.log của tôi nói rằng sau:
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)
Nếu không có ai đăng tải bài trả lời, bạn có thể thử [http: // webdevrefinery. com /] (http://webdevrefinery.com/). Có một loạt các acolytes RoR mà treo xung quanh ở đó vào giờ lẻ. –
Cảm ơn tôi sẽ ghi nhớ điều đó. – dbuizert
Liên kết này với '/ index' được tạo như thế nào? Bởi vì gốc không nên là '/ index' nhưng chỉ đơn giản là'/'. – nathanvda