Rails 服务器路由错误 [英] Rails Server Routing Error
本文介绍了Rails 服务器路由错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试使用本地主机的 URL 访问 Web 应用程序时遇到路由错误.
I am getting a routing error when trying to access the web application with the URL for the localhost.
Ruby on Rails 3.2 和 Windows 7.
为什么会发生这种路由错误?有人对如何解决这个问题有建议吗?
Why does this routing error happen? And does anybody have a suggestion how to fix this?
http://localhost:3000/web_app_name
错误信息:
在网络浏览器中:
Routing Error
No route matches [GET] "/web_app_name"
在命令提示符中:
Started GET "/web_app_name" for 127.0.0.1
ActionController::RoutingError (No route matches [GET] "/web_app_name"):
actionpack (3.2.9) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (3.2.9) lib/action_dispatch/middleware/show_exceptions.rb:56:in `ca ll'
railties (3.2.9) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.9) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.9) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.9) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.9) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.9) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.9) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.9) lib/rails/engine.rb:479:in `call'
railties (3.2.9) lib/rails/application.rb:223:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.9) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `servi ce'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
Rendered C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.9/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (78.0ms)
附录:
routes.rb"文件:
web_app_name/config/routes.rb
Addendum:
The "routes.rb" File:
web_app_name/config/routes.rb
WebAppName::Application.routes.draw do
end
耙子路由命令:
rake routes
命令不会在命令提示符中产生输出.
The rake routes Command:
The rake routes
command does not produce an output in the command prompt.
推荐答案
您是否在 routes.rb
文件中添加了路由?!请出示!
Did you add the route in routes.rb
file ?! Show it, please!
应该是这样的:
root :to => "controller_name#action_name"
这篇关于Rails 服务器路由错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文