我正在尝试访问:

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匹配。
注释掉这两行,它将起作用,这是在所有应用程序中使用RESTful路由时要执行的操作。

有关您需要了解有关Rails路线的所有信息,请参见this excellent guide

关于ruby-on-rails - 我无法在Ruby on Rails上提供静态图片,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/2212065/

10-14 16:08
查看更多