What is the url you're using to show this on a separate page ?

if its in the pattern of "/cards/:id/something" then you dont have to
provide the card path as rails picks up @card object to build the path or
you'll have to pass the card variable inside the path method.

eg

<% @cards.each do |card| %>
  <li><%= link_to '<i class="fa fa-money"></i> Card'.html_safe,
cart_path(card) %> </li>
<% end %>

This way, rails would know "which" exact card this link should take them
to.


On Mon, Dec 8, 2014 at 6:48 PM, Roelof Wobben <[email protected]> wrote:

> Hello,
>
> I follow the Agile Web development book.
>
> Now as a extra challenge I try to make the card visible on a seperate page.
>
> So I made this link :
>
> <li><%= link_to '<i class="fa fa-money"></i> Card'.html_safe, cart_path %>
> </li>
>
> But now I see the above error message.
> When I do card_path (:id) I see a message that there is no card with the
> id of id.
>
> Roelof
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/9442f58f-58b5-475e-823d-c797431c41c3%40googlegroups.com
> <https://groups.google.com/d/msgid/rubyonrails-talk/9442f58f-58b5-475e-823d-c797431c41c3%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAFKVRj9PWK_Zdaa_81Ufi8ps03mwt2ScRZn%3DQ3zW9aiG2eN27g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to