creddit/app/helpers/comments_helper.rb

11 lines
335 B
Ruby
Raw Normal View History

2015-07-16 11:57:27 -04:00
module CommentsHelper
def nested_comments(comments)
comments.map do |comment, sub_comments|
render(comment, post: comment.post, subcreddit: comment.post.subcreddit) +
content_tag(:div,
nested_comments(sub_comments),
class: 'nested_comments')
end.join.html_safe
end
end