Getting likes for multiple records at once #19

MikeSilvis opened this Issue Sep 19, 2012 · 4 comments

4 participants



I have the following:

movies = Movie.all

movies.each do |m|
  puts m.likers(User)

and this n*2 queries. Is there anyway to do an includes such that it on Movie.all such that it only queries users once.


It's a bit tricky since we support both Redis and ActiveRecord as a backend. Not sure how this could be implemented properly to be implemented across both?

But indeed, that'd be a great addition. If somebody wants to submit a PR, it would be appreciated.




+1, any updates?


@MikeSilvis I did a pull request(#31), I'm not sure it helps in your context, but if you need only the number of likers, then it should be good enough for your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment