5 show a tag


#1



BokenjiKan





<%= @tag.title %>

<div class="cards row">

 <% @destinations.each do |d| %>
  <div class="card col-xs-4">
    <% destination.image %>
    <h2> <% destination.name %></h2>
    <p> <% destination.description %> </p>
  </div>
  <% end %>

</div>



#2

Hi @rubyninja34657,

If you're still trying to figure this one out, here's what you should change:

1. When you iterate through |d|, you have to continue to use |d|, so the places where you use destination., you need to use d.

For example, change

<% destination.image %>

to

<% d.image %>

You have to keep it consistent over your loop. That way, your code knows what it's supposed to do with what the value it's iterating over.

2. You have to be careful of the difference between <%= %> and <% %>

There's a separate thread that goes over this in more depth, but basically, <%=> will return the result of what's inside it, and <%> will do whatever is inside it. In this case, you need to return information for destination.image, destination.name, and destination.description

With those changes, your ending code should look something like this:

   <% @destinations.each do |d| %>
      <div class="card col-xs-4">
        <%= d.image %>
        <h2><%= d.name %> </h2>
        <p><%= d.description %> </p>
      </div>
    <% end %>

The rest of your code is correct :slight_smile:


#3

You need "=" in the ruby code.