/bans: avoid N+1 queries for user, banner.
Avoids an N+1 issue when rendering users with link_to_user.
This commit is contained in:
@@ -11,9 +11,10 @@ class BansController < ApplicationController
|
||||
end
|
||||
|
||||
def index
|
||||
@bans = Ban.search(params[:search])
|
||||
@bans = @bans.paginate(params[:page], :limit => params[:limit])
|
||||
respond_with(@bans)
|
||||
@bans = Ban.search(params[:search]).paginate(params[:page], :limit => params[:limit])
|
||||
respond_with(@bans) do |fmt|
|
||||
fmt.html { @bans = @bans.includes(:user, :banner) }
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
Reference in New Issue
Block a user