Movies || 3/5


#1

in this part of the module: In app/view/movies/show.html.erb

  • Inside <div class="movie">...</div> , display the movie’s image, title, release year, and plot.
  • Below <h2>Cast</h2> , iterate through each actor and display the image, first name, last name, and bio.
<div class="main movie-show">
  <div class="container">
    <div class="movie">
      
      <!-- Display the movie's info here -->
      <div class="info">
        <!-- movie image -->
        <%=@movie.image%>
        <h3 class="movie-title"><%=@movie.title%>  </h3>
        <p class="movie-release-year">  <%=@movie.release_year%></p>
        <p class="movie-plot">  <%=@movie.plot%></p>
      </div>
    </div>

    <h2>Cast</h2>
    <!-- Display each actor's info here -->
    
    <div class="actor">
      <%@actors.each do |a|%>
      <!-- actor image -->
      <%=a.image%>
      <h3 class="actor-name"> <%=a.first_name%><%=a.last_name%> </h3>
      <p class="actor-bio"> <%=a.bio%> </p>
    </div>
    <%end%>

  </div>
</div>

the error says : undefined method `name’ for nil:NilClass
what am I doing wrong