I'm trying to prevent merb from making so many queries.   When
I .to_yaml an Order It does a query for every row in the order, which
seems rather redundant to me.  I can't find a good example of eager
loading so I would appreciate either some advice or some information
on how to get it going in my situation :)

Thanks much :)



Here is my basic data structure:

Order
Product
Order_Products  (order_id, product_id)

My controller is something like this:
...
def index
  @test =  Order.get(:limit => 5)
  display @test
end
...

My view:

...
- for test in @test
  %tr
    %td
      %pre
        = test.to_yaml
        = test.charges.to_yaml
...
# so when I do test.charges.to_yaml it does far too many queries

-- 
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/merb?hl=en.

Reply via email to