作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
好的,所以我已经升级到 Rails 4(在我的 10.9 服务器更新中是计划外的)并且能够在我的照片库应用程序上运行除路线之外的所有内容。出于某种原因,自从 rails 3 以来,我一直无法理解路线。这是我之前在 Rails 3 下的工作代码
root :to => "gallery#index", :as => "gallery"
get 'gallery' => 'gallery#index'
resources :galleries
match 'gallery_:id' => 'gallery#show', :as => 'gallery'
:as
定义了两条同名的路由。选项,或者您可能会覆盖已由具有相同命名的资源定义的路由。
最佳答案
试试这个
match 'gallery_:id' => 'gallery#show', :via => [:get], :as => 'gallery_show'
关于ruby-on-rails - rails 4 : You should not use the `match` method in your router without specifying an HTTP method,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19798466/
我是一名优秀的程序员,十分优秀!