On 9 February 2017 at 17:49, Joe Guerra <email@example.com> wrote:
> I've got a simple cart table with a link to a product id.
> I'd like to grab the values from the product table that match the product id
> in the cart, but I'm looping thru the cart in an index view.
> So, I wasn't quite sure how to accomplish this.
Assuming that you have Cart has_many products, and if you haven't then
you probably should have, then you can say (if the cart is in @cart)
@cart.products.each do |product|
# at this point product contains the Product
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 firstname.lastname@example.org.
To post to this group, send email to email@example.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuqsG%3DrppV2vVvppuG0HJq-K61fz-VhzOJ1EjG1rbMK8w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.