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| %>
<%= link_to ' Card'.html_safe,
cart_path(card) %>
<% end %>
This way, rails would know “which” exact card this link should take them
to.
But why would you goto to the show page ( /cards/:id/ ) when you’re
already
on the page ? regarding the cart, You have to follow the same procedure.
define @cart in the controller/action and use it like this