You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Also I assume most times this method is used, shopping_cart_items will eventually be loaded. So maybe ruby math would be better. Plus if you need to run shopping_cart_items.sum(:total) & shopping_cart_items.sum(:quantity) you now have two queries then a possible 3rd query later if shopping_cart_item objects are needed.
I think optimizing this will eventually be up to the implementation. The frontend of ror_ecommerce will be updated by most sites and hence I'm leaning toward keeping the method as it currently stands and let any dev optimize for their site.
That said, this is interesting and I'd like to here your thoughts on my reasoning.
to
doing sum is faster in db side
The text was updated successfully, but these errors were encountered: