Related Posts

Ruby code posted
created at 29 Dec 22:05

Edit | Back
1
2
3
4
5
6
7
def find_Related_Posts(post)
     results = Set.new
     post.tag_list.each do |tag|
       results << Post.find_tagged_with(tag).select {|p| !(p.eql?(post)) }.collect {|p| link_to(p.title, p)}.join(" ")
     end
     results.to_a
   end
243 Bytes in 10 ms with coderay