6.5 Error: “Did you add the link to the destination?”

I completly stuck on the 6.5, with the error “Did you add the link to the destination?” the last part.

I have seen all the topics on the forum but I still have the message error and I don’t get why ?

This is my code in app/views/tags/show


<div class="header">
  <div class="container">
    <img src="http://s3.amazonaws.com/codecademy-content/courses/learn-rails/img/logo-1tm.svg" width="80">
    <h1>BokenjiKan</h1>
  </div>
</div>

<div class="tag">
  <div class="container">
    <h2 class="tag-title">  </h2>

    <div class="cards row">

     <% @destinations.each do |destination| %>
  <div class="card col-xs-4">
    <%= image_tag @destination.image %>
    <h2><%= @destination.name %></h2>
    <p><%= @destination.description %></p>
   <p><%= link_to "See more", destination_path(@destination) %></p>
  </div>
  <% end %>
      

    </div>

  </div>
</div>

What do I do wrong ?

https://www.codecademy.com/en/courses/learn-rails/lessons/one-many/exercises/one-many-show-destination?action=resume

Hi Mc,

Inside your @destinations.each do ... loop, instead of using @destination, use destination. It should look like this :slight_smile::

<% @destinations.each do |destination| %>
  <div class="card col-xs-4">
    <%= image_tag destination.image %>
    <h2><%= destination.name %></h2>
    <p><%= destination.description %></p>
    <%= link_to "See more", destination_path(destination) %>
  </div>
<% end %>

Ok, I get that, I shouldn’t use @ before destination.

Now I corrected my mistake but I still stuck.
With Error: “Did you add the link to destination ?”
:frowning:

@mc_rosbeef :confused: Could you post your updated code, please?

Yes, below this is my code :


<div class="header">
  <div class="container">
    <img src="http://s3.amazonaws.com/codecademy-content/courses/learn-rails/img/logo-1tm.svg" width="80">
    <h1>BokenjiKan</h1>
  </div>
</div>

<div class="tag">
  <div class="container">
    <h2 class="tag-title">  </h2>

    <div class="cards row">

   <% @destinations.each do |destination| %>
  <div class="card col-xs-4">
    <%= image_tag destination.image %>
    <h2><%= destination.name %></h2>
    <p><%= destination.description %></p>
    <%= link_to "See more", destination_path(destination) %>
  </div>
<% end %>
      

    </div>

  </div>
</div>

@mc_rosbeef I’m having some trouble getting the exercise to load, so I can’t test that code myself right now :confused:

It looks fine to me, but maybe you should fill in this <h2>:

<!-- this: -->
<h2 class="tag-title">  </h2>

<!-- into this: -->
<h2 class="tag-title"><%= @tag.title %></h2>

?

I added <%= @tag.title %>
I don’t understand why this is still not working…
For me everything looks good, is horrible to be stuck like this :worried:

@mc_rosbeef Sorry, but I’m not sure what’s wrong :confused:

It might help if you restart the exercise (“Get Help” → “I Want to Reset this Exercise”), or if you switch browsers.

Please let me know if you get passed, though!

did you happen to figure out what was wrong? I’m working on the same problem right now and getting the same message. Which is driving me nuts cause the link is showing up and functioning correctly it takes you to the correct destinations page with no errors and everything renders properly. have tried restarting, but only problem is when I restart it makes me redo all the previous steps even though they are done and saved.

for some reason it won’t accept the
<% @destinations.each do |destination| %> for the link. it works in the broser but the code test fails.
if you just change the |destination| to |d| and change the corresponding destination.image, .name, .description to d.name so on and so forth. don’t forget to change the destination_path(destination) to destination_path(d) that should solve your problem.

1 Like

Thank you. Your idea solve a problem. Thanks
(I changed |destination| to |d| )

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