6.3 Show a destination


#1

CODE:
Destinations_Controller:

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

Routes.rb:

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

Error:
undefined local variable or method `id' for #<DestinationsController:0x00000004b39350>

Exercise Link


#2

Hi @snaylz,

params:[id]

The colon (:) needs to go inside the square brackets ([]) :slight_smile:


#3

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.