Hi,

I have two models Item and Review. Item has one_to_many association with 
Review. Review has rating column which stores integers from 1 to 10. Rating 
of an item equals avg of the rating column in item's reviews_dataset.

When I list the items, I want to list the rating as well. But the issues 
here is that I am calling DB 'N' no. of times for each item. Basically a N 
+ 1 problem. I have used eager loading for the associations to solve the N 
+1 issue for the associations. But, the average here is not an association. 
Is there a way I can use eager functionality (or some other way) to load 
the average of a column in the associated dataset and not face the N +1 
issue.

Thanks,
Satya

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to