/notes, /note_versions: fix N+1 queries on note creators, updaters.

This commit is contained in:
evazion
2017-04-23 14:54:33 -05:00
parent 989917cb07
commit 808fe0411a
2 changed files with 2 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ class NoteVersionsController < ApplicationController
def index
@note_versions = NoteVersion.search(params[:search]).order("note_versions.id desc").paginate(params[:page], :limit => params[:limit])
respond_with(@note_versions) do |format|
format.html { @note_versions = @note_versions.includes(:updater) }
format.xml do
render :xml => @note_versions.to_xml(:root => "note-versions")
end

View File

@@ -8,6 +8,7 @@ class NotesController < ApplicationController
def index
@notes = Note.search(params[:search]).order("id desc").paginate(params[:page], :limit => params[:limit], :search_count => params[:search])
respond_with(@notes) do |format|
format.html { @notes = @notes.includes(:creator) }
format.xml do
render :xml => @notes.to_xml(:root => "notes")
end