legendary_rob
legendary_rob

Reputation: 13012

Rails, No route matches {:action=>"show"

This is stumping me, made a new controller

class ScorecardsReviewController < ApplicationController
  before_filter :require_staff_user

  layout 'unbranded'

  def index
    @scorecards = Scorecard.in_review
  end
end

added this to the routes

  resources :scorecards_review

added a link on the home page

.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

refreshed the app and i get the following

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

when i rake the assets then i find all is there

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

i dont know what it could be??

Upvotes: 3

Views: 4593

Answers (2)

fengolly
fengolly

Reputation: 503

I think you probably want

resources :scorecards_reviews # plural

which will give you a route to the index action, which I think it what you're looking for.

Upvotes: 4

John Douthat
John Douthat

Reputation: 41199

You probably need to change scorecards_review_path to scorecards_reviews_path (with an s on the end of reviews)

Upvotes: 5

Related Questions