Rails 服务器路由错误

编程入门 行业动态 更新时间:2024-10-21 11:46:32
本文介绍了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?

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 服务器路由错误

本文发布于:2023-10-12 17:02:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1485326.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:路由   错误   服务器   Rails

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!