ruby-on-rails – 我不能在Ruby on Rails上提供静态图像
发布时间:2020-12-17 04:33:51 所属栏目:百科 来源:网络整理
导读:我正在尝试访问: http://localhost:3000/images/Header.png 但我一直收到这个错误: Routing ErrorNo route matches "/images/Header.png" with {:method=:get} 以下是我的路线: ActionController::Routing::Routes.draw do |map| map.resources :worker_a
我正在尝试访问:
http://localhost:3000/images/Header.png 但我一直收到这个错误: Routing Error No route matches "/images/Header.png" with {:method=>:get} 以下是我的路线: ActionController::Routing::Routes.draw do |map| map.resources :worker_antpile_statuses map.resources :worker_antpiles map.resources :antcolonies map.resources :antpiles map.resources :clients map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' end 解决方法
routes.rb的最后两行是与所有以前不匹配的URL匹配的catch-all路由.
注释掉这两行并且它将起作用,这是您在所有应用程序中使用RESTful路由时要执行的操作. 有关Rails路由的所有信息,请参阅this excellent guide. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |