Movies does not show up after clicking on an actor


#1

I have passed every instruction but in the end when I click on the link "learn more" the details of actor shows up but not the the movies that actor is a part of, what am i doing wrong? The code of show.html.erb for Actor is given below-


<!-- Display an actor's info here -->
<div class="actor">
  <%= image_tag @actor.image %>
  <div class="info">
    <h3 class="actor-name"> <%= @actor.first_name %> <%= @actor.last_name %></h3>
    <p class="actor-bio"> <%= @actor.bio %> </p>
  </div>
</div>

<h2>Movies</h2>
<% @movies.each do |m| %>
<div class="movie">
   <%= image_tag m.image %>
  <h3 class="movie-title"> <%= m.title %> </h3>
  <p class="movie-release-year"> <%= m.release_year %> </p>
  <p class="movie-plot"> <%= m.plot %> </p>
</div>
<% end %>


the code for actors_controller.rb is -
class ActorsController < ApplicationController
def index
@actors = Actor.all
end

def show
@actor = Actor.find(params[:id])
@movies = @actor.movies
end
end

Any help would be appreciated !


Actors showing up more than once and some links show the movies while some don't
#2

Are You sure? The movies should be written below information about an actor. In small window You must scroll the page down.
I write about it because I thought also that I had made something wrong… :smile: