Exercise 6.5 bugged? Did you add the link to the destination?


#1

Hi Everyone,

I am stuck on this exercise and I cannot find out why, I already tried restarting it twice, before I got stuck at 6.3, did it again with the exact same code and moved on up to 6.5, now stuck again on:
https://www.codecademy.com/en/courses/learn-rails/lessons/one-many/exercises/one-many-show-destination?action=resume

It keeps saying: Did you add the link to the destination? I'm pretty sure I did and cannot spot if there is a syntax error, reviewed it tens of times.

I tried making the link_to line of code inside an html paragraph, even storing @destination instance variable into a local variable, and going through @destinations on an each loop, (as I see on some posts for this exercise), although it does not say to iterate at this point. Tried changing the code to the one of others which worked.. I think unfortunately this Rails Course may be bugged, or I made some mistake much earlier which 'passed' and is now making issues.. and restarting is not fixing it. I was al hyped about the site after the Ruby course which was great, can you help me get my faith back? 2nd day on it and It's getting really annoying.
Oh and there's also the fact that I submitted this as a bug yesterday and today, already 3 times with no answer. Pay to win only? :stuck_out_tongue:

Thanks in advance,
Diego

Code below:
app/views/destinations/show.html.erb

<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="destination">
  <div class="container">
    <div class="row">
      <div class="col-xs-12">
        <%= image_tag @destination.image %>
        <h2> <%= @destination.name %> </h2>
        <p> <%= @destination.description %> </p>
        <%= link_to "See more", destination_path(@destination) %>
      
      </div>
    </div>
  </div>
</div>

routes.rb

Rails.application.routes.draw do
  get 'tags' => 'tags#index'
  get '/tags/:id' => 'tags#show', as: :tag
  get '/destinations/:id' => 'destinations#show', as: :destination
end

destinations_controller.rb

class DestinationsController < ApplicationController
  def show
  	@destination = Destination.find(params[:id])
  end  
end

tags_controller.rb

class TagsController < ApplicationController
  def index
    @tags = Tag.all
  end
  
  def show 
    @tag = Tag.find(params[:id]) 
    @destinations = @tag.destinations 
  end
end

#2

This looks more like the code for app/views/destinations/show.html.erb. The tags#show file looks quite different from this one.


#3

Did you find solution to this? I am facing exactly the same problem.


#4

That is correct, it is app/views/destinations/show.html.erb, confused the path. I am editing the post to avoid confuson. Thanks :slight_smile:


#5

Hi suryakanttyagi - Nop, didn't touch it - went to sleep after the post.
I will probably try starting it from zero again later - seems educational up to a point where it feels more like a bug in this codecademy course than an error in the actual code.


#6

This line does not get added until the next lesson (and it doesn't look like this). The line above is the one from tags#show. Try removing it and see what happens.


#7

Hi mtf (not insulting, just the username), thanks for the suggestion, I will try that but I think I found the issue even before that.

I tried to start the whole Associations I lesson from scratch, by resetting the code from exercise 1. That did not work as it does not delete the code, you just keep getting previous files from every next lesson/step and even that did not allow me to continue correctly (how do you rails generate controller tags, if the controller is already there. If you delete it, other things stop working..) anyway,

At some point I went to 5.5 which says:

Finally in app/views/tag/index.html.erb within the <% @tags.each do |t| %>...<% end %> block, add this link:

<%= link_to "Learn more", tag_path(t) %>
By giving the route in step 1 the name "tag", Rails automatically creates a helper method named tag_path. We use tag_path(t) here to generate the URL to a specific tag's path, for example /tag/1.

I DO NOT have that tag folder in views. I only have tags folder. That is where is broken and I cannot get it corrected, even starting from 1.1 and resetting all exercises, that folder and its files never get created... :frowning:

Any ideas?


#8

That must be a typo in the lesson text. I'll send a PR to fix this. The problem I face is that my code is completed and the later steps change things that were done in the earlier ones. It's tricky to spot what the problem might be in your case.


#9

Thank you.

Well.. I finally got past this. After resetting from exercise 1 (for the 3rd time), it seemed to work. I got some parts autocompleted from previous attempts as I went on through the lesson, but finally just got past 6.5

There was a typo indeed for sure or something wrong, the issue is that it was not resetting and it was making me crazy :stuck_out_tongue:

So the solution, or the closest I can provide for one, is:

1 - Go to the exercise 1 of the Lesson.
2 - Reset your code.
3 - Try to advance through the course. If one exercise gives errors, reset that exercise. If still with errors, reset the previous one.
4 - Ignore some errors if they allow you to continue anyway. For example, all the generate controllers and models part shouted at me because even resetting, the files were still there from when I generated them on previous lessons, although now they may have the contents cleared, but the console complained anyway.
5 - Hopefully, it will work.
Note: There is no way to reset the entire lesson, I looked a lot for this and the only suggestion from CodeCademy is to either delete your account and re-register, or.. re-register with a different email -.-
So my steps are the closest I could find for this, hopefully they work for you too :slight_smile:

Thanks again,
Happy coding!


#10

I know my question doesn't relate to the topic, but I need a fast answer to my code on step three for "Show A Tag". Please help!


#11

Sorry, doesn't work that way. If you have a question start a new topic and tell us your problem Asking for a fast answer is not going to cut it, I'm afraid.


#12

I forgot a comma, lol.


#13