Skip to content

Instantly share code, notes, and snippets.

View peterlcullen's full-sized avatar

Peter Cullen peterlcullen

  • Los Angeles, CA
View GitHub Profile
class CommentsController < ApplicationController
def users_comments
posts = Post.all
comments = posts.map(&:comments).flatten
@user_comments = comments.select do |comment|
comment.author.username == params[:username]
end
end
end