Last active
June 4, 2018 13:44
-
-
Save alekseyl/c0ada264b47071efc7652ac18e5ced60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CommentsController < ApplicationController | |
# I assumed the usual naming for models and foreign columns | |
def users_comments | |
# I don't like where( post_id: Post.all ) but if table comments | |
# contains deleted posts comments or even NULLs than we need to keep it this way | |
@user_comments = Comment.where( post_id: Post.all ) | |
.where(author_id: Author.where( username: params[:username]) ) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment