Hi! I’m not quite understanding what Movies I Part 3 wants.
This is the given instructions:
Then in the Movies controller, add the index action to display a list of all movies. To do this, fetch all movies from the database and store them in variable @movies.
This is what I have written
class MoviesController < ApplicationController
def index
@movies = Movies.all
end
def show
@movies = Movies.find(params[:id])
end
end
I’m super confused. would appreciate some help! thank u
You’re pretty close! Movie is the database table which stores all of the movies. Even though it sounds a little weird, being non-plural, you actually need to use Movie to get a movie out of the database, like this for example:
@movies = Movie.all
And in your show action, @movies should also be singular (@movie) since it’s only one movie