How can I get all the items for this? i.e. update reports html item model Simple: Map items. This will give you: To get exclusive items: It is not a permanent way of bringing related items; N + 1 Performance Problems Be Careful More generally, you should do something like this: And just call: @ orders.closed_today is an array of all orders closed for today.
@Itms = @order.closed_tayday.itms
& lt; % @items = Item.in_orders (@ Orders.closed_today)%>
scope: in_orders, lambda {| Order | Where ('in order_id (?)', Orders.map (& id) .join (','))}
@items = @order.closed_tod.l (: include = & gt;: item) .map (& amp;; item)
= & gt; [[Item 1, Item 2], [Item 2, Item 3]]
@order.close_toded. L (: included =>: items) .map (and: items). Flaten.Yinek
area of square item: closed_tode, joins (: order) & amp;
Item.closed_today
Comments
Post a Comment