@peheu Huh, I’m not sure why it works in one browser tab but not in the other.
You shouldn’t be looping through all destinations in your show action, though. In the destinations controller, it should have @destination = Destination.find(params[:id]), rather than @destinations = .... Then, in your showview, you should have something like this instead of your current code:
I am having the same issue as the person above did. Moderator zystvan, in your reply you say, “I think that the code you posted belongs in app/views/tags/index.html.erb, not show.html.erb, but I’d like to check the exercise :slightly_smiling.” That is good information to have because the instructions to the exercise tell the programmer to insert the code into “app/views/tags/show.html.erb.” See below:
Finally in app/views/tags/show.html.erb below a destination’s description, use link_to to add a link to that destination:
Use “See more” for the link text
By giving the show route a name of “destination”, Rails automatically creates a helper method named destination_path. Use destination_path to generate a URL to a specific destination’s path.
So is there an error in the instructions? That’s probably why everyone is having the same problem.
@bitsolver32602 No, I was mistaken. When I looked at the exercise with the link Peheu provided, it looks like you’re both right, show.html.erb is the correct file
I think the problem you all are having is that I think the problem you all are having is that you’re looping through all the destinations (@destinations.each do...), when you should have a variable, @destination, that stores the current destination and you show just that, none of the other destinations.
Thank you for the clarification zystvan. I am still stuck on part 5 and losing my mind. I’ve wasted 3 days stuck on this one exercise and it’s completely obstructing my learning. It seems like many other students on this site are struggling with this exercise. I’ve looked at EVERY forum discussion and tried EVERY code suggested and I’m still stuck.
I’ve revised my code yet again using the advice your provided in your reply above. It still DOES NOT WORK! Please see my code below. I’ve highlighted the pertinent code in BOLD. What am I missing??? Please help.
The Helper finally gave me the solution code so I was able to understand and reverse engineer the solution to move on in the learning modules. This is the code I was attempting to submit before that the website would not accept as a solution:
<% @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>**
<% end %>
I am still curious as to why that does not work. Can you please explain?