5. Show a Tag / Association I

All code sems to be correct (sometimes already written ?) yet it’s not accepted

ERROR MESSAGE : undefined method `destination_path’ for #<#Class:0x00000004867820:0x0000000485f120>7


What Destination Path has to do with my code ?

Thanks all !

Hi @slibre2,

You’re using the destination_path helper in the code in your screenshot. You’ll need to make sure it’s defined in your config/routes.rb file


Hello Zystvan ,
Do you mean that destination_path must be written in config/routes.rb file ?
thanks hc!

Yes, it’ll probably need to look about like this:

get '/destinations/:id' => 'destinations#show', as: :destination_path

Hi Zystvan ,
I m afraid it’s refused . It doesn’t work . Look :

According to me problem is different : it is the way the code was written in app/views/tags/show.html.erb file . A mistake in Div Class . The code was not written in the good one .What do you think about that ?

My bad, the _path or _url will be added automatically by Rails, so it should look like this instead:

get '/destinations/:id' => 'destinations#show', as: :destination

And you’ll continue to use it as destination_path(d), like your first screenshot shows. The class name shouldn’t be the problem here.


get ‘/destinations/:id’ => ‘destinations#show’, as: :destination is already in config/route.rb
and it still doesn’t work ??? As you can see it here:

@slibre2 The last part of the line needs to be just as: :destination, not as: :destination_path.

1 Like

Thanks Zystvan ! It works ! (I understood) . I thought it was a file mistake . It was a syntaxe mistake , as most of the time .
Thanks very much for your help ! hc !

1 Like

This topic is solved.