Merge branch 'atomaka/bugfix/moren1' into 'master'
Fix some more n+1 stuff Some quick fixes. Only noteworthy thing is nested includes can be done as so: ``` Comments.all.includes(post: :subcreddit) ``` See merge request !25
This commit is contained in:
commit
5e8311c777
2 changed files with 2 additions and 2 deletions
|
@ -10,7 +10,7 @@ class SubcredditsController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
@posts = @subcreddit.posts
|
||||
@posts = @subcreddit.posts.includes(:user)
|
||||
|
||||
authorize @subcreddit
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue