Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 55b43d6fbe
Fetching contributors…

Cannot retrieve contributors at this time

34 lines (28 sloc) 1.214 kB
module Recommendable
module Helpers
module RedisKeyMapper
class << self
%w[liked disliked hidden bookmarked recommended].each do |action|
define_method "#{action}_set_for" do |klass, id|
[Recommendable.config.redis_namespace, Recommendable.config.user_class.to_s.tableize, id, "#{action}_#{klass.to_s.tableize}"].compact.join(':')
end
end
def similarity_set_for(id)
[Recommendable.config.redis_namespace, Recommendable.config.user_class.to_s.tableize, id, 'similarities'].compact.join(':')
end
def liked_by_set_for(klass, id)
[Recommendable.config.redis_namespace, klass.to_s.tableize, id, 'liked_by'].compact.join(':')
end
def disliked_by_set_for(klass, id)
[Recommendable.config.redis_namespace, klass.to_s.tableize, id, 'disliked_by'].compact.join(':')
end
def score_set_for(klass)
[Recommendable.config.redis_namespace, klass.to_s.tableize, 'scores'].join(':')
end
def temp_set_for(klass, id)
[Recommendable.config.redis_namespace, klass.to_s.tableize, id, 'temp'].compact.join(':')
end
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.