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


#1

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


#2

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 %>

#3

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:


#4

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


#5

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>

#6

@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>

?


#7

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:


#8

@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!


#9

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.


#10

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.


#11

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


#12

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