ruby-on-rails - Rails,没有路线匹配{ :action= >"show"

标签 ruby-on-rails routes

这把我难住了,做了一个新的 Controller

class ScorecardsReviewController < ApplicationController
  before_filter :require_staff_user

  layout 'unbranded'

  def index
    @scorecards = Scorecard.in_review
  end
end

将此添加到 route

  resources :scorecards_review

在首页添加了链接

.left
  = link_to 'Home', root_path
  = link_to 'About', about_home_path
  = link_to 'Legal', disclaimer_home_path
.right
  - if current_user.try(:admin?)
    = link_to 'Agencies', agencies_path
    = link_to 'Inaccurate scorecards', reported_scorecards_path
    = link_to 'Reviews', scorecards_review_path 
  - if current_user
    = link_to 'Logout', logout_path
.clear

刷新应用程序,我得到以下内容

No route matches {:action=>"show", :controller=>"scorecards_review"}

当我收集 Assets 时,我发现一切都在那里

                            POST   /scorecards_review(.:format)                                  {:action=>"create", :controller=>"scorecards_review"}
      new_scorecards_review GET    /scorecards_review/new(.:format)                              {:action=>"new", :controller=>"scorecards_review"}
     edit_scorecards_review GET    /scorecards_review/:id/edit(.:format)                         {:action=>"edit", :controller=>"scorecards_review"}
          scorecards_review GET    /scorecards_review/:id(.:format)                              {:action=>"show", :controller=>"scorecards_review"}
                            PUT    /scorecards_review/:id(.:format)                              {:action=>"update", :controller=>"scorecards_review"}
                            DELETE /scorecards_review/:id(.:format)                              {:action=>"destroy", :controller=>"scorecards_review"}

我不知道它可能是什么??

最佳答案

您可能需要将 scorecards_review_path 更改为 scorecards_reviews_path(评论末尾带有 s)

关于ruby-on-rails - Rails,没有路线匹配{ :action= >"show",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16173376/

相关文章:

ruby-on-rails - 使用 cucumber 停用功能

ruby-on-rails - Rails App Wicked 路由错误

matrix - OSRM距离矩阵

asp.net Webforms MapPageRoute 优先顺序

c# - ASP.NET Core 防止 api 路由的 spa 回退路由

ruby-on-rails - Rails 教程 : undefined local variable or method `static_pages_index_path' 中的 rspec 错误

ruby-on-rails - 为什么在 rails 中的 blob 数据类型的情况下数据库迁移失败?

ruby-on-rails - 部署时如何让 capistrano 写一个 .rvmrc 文件?

ruby-on-rails - Rails 在使用 Devise 注册后发布多步骤表单数据

asp.net-mvc-3 - 在 ASP.NET MVC 中映射自定义路由