简体   繁体   English

Ruby on Rails路由错误

[英]Ruby on Rails Routing Error

I was developing the Application in Flex and ruby on rails. 我正在开发Flex和Rails中的ruby应用程序。

It is working fine some times. 有时候运行良好。 but some times i am getting routing error. 但有时我会遇到路由错误。

Error: "No route matches "/index.html" with {:method=>:get}" 错误:“没有路由将{/ method =>:get}与“ /index.html”匹配”

Here index.html is my login page 这里index.html是我的登录页面

Please help me on this. 请帮我。

Thanks, Ravi 谢谢,拉维

If you have a static file public/index.html then this should be served up any time a direct request is made for it. 如果您有一个静态文件public / index.html,则在每次直接请求该文件时都应使用该文件。 The routing engine is simply complaining because no route for that specific path is defined. 路由引擎只是抱怨,因为没有为该特定路径定义路由。

Things to check: 检查事项:

  • Do you have a file called public/index.html that can be served up directly? 您是否有一个名为public / index.html的文件可以直接提供?
  • Do you have a route '/index.:format' defined? 您是否定义了路由“ /index.:format”?
  • See how your routing is interpreted by running: rake routes 通过运行查看如何解释您的路由:rake routes

An easy way to add a route for this particular action is, simply: 为该特定操作添加路线的简单方法是:

route.connect '/index.:format', :controller => 'login', :action => 'new'

I generally add a catch-all route at the bottom of the routing table to handle mystery URLs: 我通常在路由表的底部添加一个包罗万象的路由来处理神秘的URL:

route.connect '/*path', :controller => 'default', :action => 'not_routed'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM