rename similar posts to recommended posts, refactor menu on posts/show

This commit is contained in:
Albert Yi
2018-07-20 16:36:14 -07:00
parent b8b0f2628d
commit 9cfb629891
12 changed files with 40 additions and 24 deletions

View File

@@ -0,0 +1,20 @@
module PostSets
class Recommended < 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