Files
danbooru/app/logical/post_sets/similar.rb
2018-07-20 15:05:51 -07:00

21 lines
420 B
Ruby

module PostSets
class Similar < PostSets::Post
def initialize(post)
super("")
@post = post
end
def posts
@posts ||= begin
response = RecommenderService.similar(@post)
post_ids = response.reject {|x| x[0] == @post.id}.slice(0, 6).map {|x| x[0]}
::Post.find(post_ids)
end
end
def presenter
::PostSetPresenters::Post.new(self)
end
end
end