Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 轨道,无路径匹配{:action=>;";show";_Ruby On Rails_Routes - Fatal编程技术网

Ruby on rails 轨道,无路径匹配{:action=>;";show";

Ruby on rails 轨道,无路径匹配{:action=>;";show";,ruby-on-rails,routes,Ruby On Rails,Routes,这让我很难堪,做了一个新的控制器 class ScorecardsReviewController < ApplicationController before_filter :require_staff_user layout 'unbranded' def index @scorecards = Scorecard.in_review end end 在主页上添加了一个链接 .left = link_to 'Home', root_path = l

这让我很难堪,做了一个新的控制器

class ScorecardsReviewController < ApplicationController
  before_filter :require_staff_user

  layout 'unbranded'

  def index
    @scorecards = Scorecard.in_review
  end
end
在主页上添加了一个链接

.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"}
当我搜索资产时,我发现一切都在那里

                            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"}

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

您可能需要将记分卡\u回顾\u路径更改为记分卡\u回顾\u路径(在回顾的末尾有一个s)

我想您可能想要

resources :scorecards_reviews # plural

这将为您提供一条指向索引操作的路径,我认为这正是您要查找的。

也要更新控制器的名称(和文件名)。因为资源是复数形式使用的。然后,我为#获取此未定义的局部变量或方法“scorecards_reviews_path”,并更新您的routes.rb文件:resources:scorecards_reviews
resources :scorecards_reviews # plural