Exercise 6 Part 3 trouble


I'm having trouble finding a destination by id, and saving it in @destination. I put in this code and it said:

Oops! The test returned an error. Maybe you have a syntax error, or a typo. Hide error.
app/controllers/destinations_controller.rb:2:in <class:DestinationsController>': undefined local variable or methodparams' for DestinationsController:Class (NameError)

My code is:

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


Hi Mohamed,

You'll need to put line 2 inside of a function, like this:

def show
  @destination = Destination.find(params[:id])



Thanks :slight_smile:


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