diff --git a/app/controllers/subcreddits_controller.rb b/app/controllers/subcreddits_controller.rb index 083abea..2332315 100644 --- a/app/controllers/subcreddits_controller.rb +++ b/app/controllers/subcreddits_controller.rb @@ -10,7 +10,7 @@ class SubcredditsController < ApplicationController end def show - @posts = @subcreddit.posts + @posts = @subcreddit.posts.includes(:user) authorize @subcreddit end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2c57b82..047dd59 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2,7 +2,7 @@ class UsersController < ApplicationController def show @user = User.friendly.find(params[:id]) - @comments = @user.comments.includes(:post) + @comments = @user.comments.includes(post: :subcreddit) end def new