Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

60. What is happening in the following method (in movies_controller.rb)? def sho

ID: 3909337 • Letter: 6

Question

60. What is happening in the following method (in movies_controller.rb)? def show @movie Movie.find(params[:id]) end a. A controller action, show, is defined, which renders a new movie view b. A controller action, show, is defined, which sets an instance variable, @movie, to a specific movie c. A controller action, show, is defined, which sets an instance variable, @movie, to all movies in the database d. The code will generate an error because the params[] is missing its argument 61. What is the most likely cause of the following error message: Undefined method 'foo' for nil:Nilclass a. b. c. d. The method name 'foo' was misspelled An assignment silently failed, and you didn't error check There is no method 'foo' The method 'foo' was invoked with an argument of the wrong data type

Explanation / Answer

60.ans: b)A controller action,show is defined,which sets an instance ,@movie,to a specific movie

def show

@movie =Movie.find(params[:id])

end

The above statements define show,in which sets an

instance variable to @movie after find by id

61.ans: c)There is no method called foo

Explnanation:

When we dont define functions in classes only ,this will appear as no method called "foo"