recommendable icon indicating copy to clipboard operation
recommendable copied to clipboard

Liking multiple items

Open marcrohloff opened this issue 11 years ago • 3 comments

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.

marcrohloff avatar Feb 21 '14 00:02 marcrohloff

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.

davidcelis avatar Feb 21 '14 01:02 davidcelis

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.

marcrohloff avatar Feb 21 '14 02:02 marcrohloff

Sounds good! Please let me know what you find!

davidcelis avatar Feb 21 '14 04:02 davidcelis