首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Ruby on Rails路由问题

Ruby on Rails路由问题
EN

Stack Overflow用户
提问于 2010-10-12 08:21:54
回答 2查看 887关注 0票数 0

我在尝试访问我的页面时遇到路由错误。

代码语言:javascript
复制
Routing Error  
No route matches "/" with {:method=>:get}

错误日志为:

代码语言:javascript
复制
[4;36;1mSQL (0.1ms)[0m   [0;1mSET NAMES 'utf8'[0m
[4;35;1mSQL (0.0ms)[0m   [0mSET SQL_AUTO_IS_NULL=0[0m


Processing ApplicationController#index (for 68.116.193.166 at 2010-10-11 19:18:16) [GET]

ActionController::RoutingError (No route matches "/" with {:method=>:get}):
  config/initializers/mongrel.rb:62:in `dispatch_cgi'

Rendering rescues/layout (not_found)

通常,当我看到这一点时,我会检查是否在config/routes.rb中定义了路由,它们确实是这样的。所以我想也许我可以通过键入/new来访问它,这会给我带来以下错误。

代码语言:javascript
复制
Routing Error  
No route matches **"//new"** with {:method=>:get}

在development.log中包含以下内容

代码语言:javascript
复制
[4;36;1mSQL (0.1ms)[0m   [0;1mSET NAMES 'utf8'[0m
[4;35;1mSQL (0.0ms)[0m   [0mSET SQL_AUTO_IS_NULL=0[0m


 Processing ApplicationController#index (for 68.116.193.166 at 2010-10-11 19:18:21) [GET]

 ActionController::RoutingError (No route matches "//new" with {:method=>:get}):
config/initializers/mongrel.rb:62:in `dispatch_cgi'

 Rendering rescues/layout (not_found)

我的设置: Rails: 2.3.8 Ruby: 1.8.7 RubyGems: 1.3.7 Mongrel: 1.1.5

我觉得奇怪的是,使用地址/imgs/new会返回路径"//new“。几天来,我一直在强调这个问题,但找不到答案。希望有人知道如何修复这个问题,可以指出我在这里遗漏了什么。提前感谢

EN

回答 2

Stack Overflow用户

发布于 2010-10-12 09:03:24

下面是我的config/routes.rb文件

代码语言:javascript
复制
ActionController::Routing::Routes.draw do |map|
map.resources :vids  
map.resources :users  
map.resources :tasks  
map.resources :quotes  
map.resources :projects  
map.resources :products  
map.resources :permissions  
map.resources :pages  
map.resources :orders  
map.resources :imgs  
map.resources :documents  
map.resources :contents  
map.resources :contacts  
map.resources :comments  
map.resources :clients  
map.resources :addresses  
map.resources :users  
map.login "login", :controller => "user_sessions", :action => "new"  
map.logout "logout", :controller => "user_sessions", :action => "destroy"  
map.connect ':controller/:action/:id'  
map.connect ':controller/:action/:id.:format'  
end
票数 0
EN

Stack Overflow用户

发布于 2010-10-12 10:25:06

我刚刚意识到,我也许可以通过确保包含端口来访问模型,并且肯定www.swinkapps.com:12005/imgs会给我正确的响应。有没有一种方法可以覆盖它,使www.swinkapps.com:12005映射到www.swinkapps.com?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3910894

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档