/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
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@bans = Ban.search(params[:search])
|
@bans = Ban.search(params[:search]).paginate(params[:page], :limit => params[:limit])
|
||||||
@bans = @bans.paginate(params[:page], :limit => params[:limit])
|
respond_with(@bans) do |fmt|
|
||||||
respond_with(@bans)
|
fmt.html { @bans = @bans.includes(:user, :banner) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|||||||
Reference in New Issue
Block a user