Exercise 6 Part 3 trouble


#1

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])
end


#2

Hi Mohamed,

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

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

:slight_smile:


#3

Thanks :slight_smile:


#4

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