On Wednesday, June 14, 2017 at 7:48:52 PM UTC-7, Greg Gilbert wrote:
>
> Actually, Jeremy, one more question if you don't mind: in this example, 
> suppose you have the Order and you want to get the Products along with the 
> join. Would it be possible to get the OrderProduct representation along 
> with the Product, or do you have to write a separate set of queries for 
> that (e.g. OrderProduct.where(...))?
>

You probably should use the order_products association, and eager load the 
product association:

  order.order_products{|ds| ds.eager(:product)}.all do |op|
    op # OrderProduct
    op.product # Product
  end

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-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].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to