Basically, can I filter a dataset after it goes to the database?

order_items = OrderItem.dataset.where(order_id: orderId).all (I know this 
would query database)

orders_items_to_match.each { | match_item |
    matching_item = order_items.where(item_id: 
match_item['orderItemId']).first  (Does this go back to database or in 
memory)
}

1. Is order_items an array of OrderItem models or a dataset?
2. If dataset, would .first execute query in memory to match item_id or 
would it go back to the database
3. Is there another way to do this?  Basically I want to load all the 
Children for a Parent from the database and then filter the Children in 
memory and return a Model if a match is found.

Thanks!!
Mason

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/43c81648-19b7-4221-8371-41c2a2962c27%40googlegroups.com.

Reply via email to