davidcelis / recommendable

:+1::-1: A recommendation engine using Likes and Dislikes for your Ruby app
http://davidcelis.github.io/recommendable/
MIT License
1.36k stars 115 forks source link

Liking multiple items #88

Open marcrohloff opened 10 years ago

marcrohloff commented 10 years ago

Is there an efficient way to like multiple items together? i.e. I am currently doing: movies.each { |m| user.like(m) } but of course there are lots of inefficiencies.

davidcelis commented 10 years ago

Not currently. I'd probably accept a PR to make the rating methods take a splatted list of items, though then handling the before/after hooks may end up getting tricky.

marcrohloff commented 10 years ago

Fortunately I don't have after hooks though I agree that would make a generic solution tricky. The biggest problem would be triggering before/after blocks without triggering the before after But there a lot of requests to Redis could be pipelined and multiple calls to sadd and zadd could be coalesced in a few places. We'll have to watch performance and if it is warranted look into that PR.

davidcelis commented 10 years ago

Sounds good! Please let me know what you find!