Problem with 5.3



as you're aware many people are coming with issues regarding the section 5.3

Perhaps it's because while being taught these functions, we are not actually taught the difference between actually iterating through the array or simply typing in the displays in the HTML file.

The first bit of code below is how we are taught to display each of the separate parts of the array.

        <% @movie.each do |m| %>
      <div class="info">
        <%= 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>
      <% end %>

Here is how you are actually suppose to do it.

      <div class="info">
        <%=  @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>

Note that in the second, I do not actually iterate through the array and instead I simply post the individual information.

My question and problem with this (and it appears many others have the same) is that we are never instructed on how to tell whether we are suppose to iterate through the array or simple post write the code without iterations.

Maybe somebody could help explain this to me and maybe even update the curriculum to help with that.

I look forward to hearing back! Thank you!


Should that be @movies.each do ... ?


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