module Recommendable::Ratable::Likable

Public Instance Methods

liked_by() click to toggle source

Fetch a list of users that have liked this item.

@return [Array] a list of users that have liked this item

# File lib/recommendable/ratable/likable.rb, line 7
def liked_by
  Recommendable.query(Recommendable.config.user_class, liked_by_ids)
end
liked_by_count() click to toggle source

Get the number of users that have liked this item

@return [Fixnum] the number of users that have liked this item

# File lib/recommendable/ratable/likable.rb, line 14
def liked_by_count
  Recommendable.redis.scard(Recommendable::Helpers::RedisKeyMapper.liked_by_set_for(self.class, id))
end
liked_by_ids() click to toggle source

Get the IDs of users that have liked this item.

@return [Array] the IDs of users that have liked this item

# File lib/recommendable/ratable/likable.rb, line 21
def liked_by_ids
  Recommendable.redis.smembers(Recommendable::Helpers::RedisKeyMapper.liked_by_set_for(self.class, id))
end