mardi 3 mars 2015

Reduce N+1 Queries

N+1 queries detected what does that mean what should i do to make it work.


I am using Bullet gem for showing N+1 queries



user: kalyan
N+1 Query detected
Emp => [:functions]
Add to your finder: :include => [:functions]
N+1 Query method call stack
/home/Documents/app/views/tics/show.html.haml:20:in `_app_views_tics_show_html_haml___2301551533476719406_237290860'


This is the message from bullet gem.


_app_views_tics_show.html.haml



- if (@tic.assigned_to == current_user.emp) or (current_user.emp_functions.map{|x| x.id}.include?(1) if current_user.emp_functions.present? )
= best_in_place @tic, :subject
- else
= @tic.subject


help me to reduce n+1 query problem


Aucun commentaire:

Enregistrer un commentaire