Movies II 5/7


#1

Hello guys, in instruction nº 3 , im getting this error : undefined method `name' for nil:NilClass , and i'm not really understanding why, since i dont have any method (i guess that is what i can call it) related to actor nor movie called "name"

Here is my code related to step 3

<div class="main movie-show">
  <div class="container">
    <div class="movie">
      
      <!-- Display the movie's info here -->
      <div class="info">
        <%= image_tag @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>
    <% @actors.each do |actor| %>
    <div class="actor">
      <%= image_tag actor.image %>
      <h3 class="actor-name"><%= actor.first_name %> <%= actor.last_name %></h3>
      <p class="actor-bio"><%= actor.bio %></p>
    </div>
		<% end %>
  </div>
</div>

Help is appreciated :smile:


#2

Rails should give you the lines of your code where error occured. Can you copy it?


#3

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