Associations I - Show a destination

I’m working on the ‘Show a destination’ section, and am getting the following error message:

/destinations/:id should route to destinations#show

This is what I have so far for the routes file:

Rails.application.routes.draw do
get ‘/tags’ => ‘tags#index’
get ‘/tags/:id’ => ‘tags#show’, as: :tag
get ‘/destinations/:id’ => ‘destinations#show’, as: :destination
end

Hi @aroc725,

Are you still having trouble with this?

Nope, not any more. Now I have another problem, lol.

My latest error message is now this:

Missing template destinations/show, application/show with {:locale=>[:en], :formats=>[:html], :variants=>, :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}. Searched in: * “#RSpec::Rails::ViewRendering::EmptyTemplatePathSetDecorator:0x00000003e34830

after submitting my solution for part 3. Here’s what I have for the Destinations controller class:

class DestinationsController < ApplicationController
  def show
    @destination = Destination.find(params[:id])
  end
end
1 Like

@aroc725 Are you missing a show.html.erb file? It should be in app/views/destinations/.

Correct, I’m not seeing any files in that subdirectory.

It’s a cryin’ shame, I tells ya.

@aroc725 I’m not sure why the file wasn’t created, but resetting the exercise usually fixes the issue. Here’s the base code for app/views/destinations/show.html.erb so you don’t have to reset your progress, though:

<div class="header">
  <div class="container">
    <img src="http://s3.amazonaws.com/codecademy-content/courses/learn-rails/img/logo-1tm.svg" width="80">
    <h1>BokenjiKan</h1>
  </div>
</div>

<div class="destination">
  <div class="container">
    <div class="row">
      <div class="col-xs-12">

        <!-- Your code here -->
      
      </div>
    </div>
  </div>
</div> 

You can create the new file by clicking the 3 dots beside the parent folder’s name and selecting “New File”

(For my reference, this is the exercise URL: https://www.codecademy.com/courses/learn-rails/lessons/one-many/exercises/one-many-show-destination)

1 Like

Same issue with not able to find the show.html.erb file.
Fixed with creating this provided template for app/views/tags/show.html.erb.

1 Like