Optimisation on database fetches for the organisations listing

This commit is contained in:
echarp 2015-12-27 01:36:04 +01:00
parent 127d043691
commit 389064915f

View File

@ -7,7 +7,7 @@ class OrgasController < ApplicationController
before_action :authenticate_user!, only: [:validate, :accept]
def index
@search = Orga.moderated.search params[:q]
@search = Orga.moderated.includes(:kind).includes(:region).search params[:q]
@search.sorts = 'name' if @search.sorts.empty?
@orgas = @search.result.page params[:page]
end