ror_ecommerce icon indicating copy to clipboard operation
ror_ecommerce copied to clipboard

count could be size , so that when it's loaded, the size will be faster than count

Open lelelelemon opened this issue 8 years ago • 3 comments

ror_ecommerce/app/views/admin/users/show.html.erb:22:

  • <%= shipment.order_items.count %>
  • lelelelemon avatar Aug 23 '17 03:08 lelelelemon

    👍

    drhenner avatar Aug 23 '17 07:08 drhenner

    After looking

       User.includes([:shipments, :finished_orders, :return_authorizations])
    

    I would have to have :shipments => [:order_items] in the includes. Unless I'm missing something :order_items aren't loaded so doing count might be better and from a memory footprint not loading the order_items is definitely better.

    drhenner avatar Aug 23 '17 07:08 drhenner

    right, this will also be a good solution

    lelelelemon avatar Aug 23 '17 15:08 lelelelemon