From 372db7a3d062adc1479a52d05b8f6138bde4fa07 Mon Sep 17 00:00:00 2001 From: George Opritescu Date: Sat, 7 May 2016 17:35:26 +0300 Subject: [PATCH] Fixed some n+1 queries --- app/views/agents/_action_menu.html.erb | 2 +- app/views/agents/show.html.erb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/agents/_action_menu.html.erb b/app/views/agents/_action_menu.html.erb index 4cd48454..e5fd31c7 100644 --- a/app/views/agents/_action_menu.html.erb +++ b/app/views/agents/_action_menu.html.erb @@ -47,7 +47,7 @@
  • - <% if agent.can_create_events? && agent.events.count > 0 %> + <% if agent.can_create_events? && agent.events_count > 0 %>
  • <%= link_to icon_tag('glyphicon-trash', class: 'color-danger') + ' Delete all events', remove_events_agent_path(agent, return: return_to), method: :delete, data: {confirm: 'Are you sure you want to delete ALL emitted events for this Agent?'}, tabindex: "-1" %>
  • diff --git a/app/views/agents/show.html.erb b/app/views/agents/show.html.erb index 1b9f737d..7a8a9fa7 100644 --- a/app/views/agents/show.html.erb +++ b/app/views/agents/show.html.erb @@ -14,7 +14,7 @@
  • '> Logs
  • - <% if @agent.can_create_events? && @agent.events.count > 0 %> + <% if @agent.can_create_events? && @agent.events_count > 0 %>
  • <%= link_to icon_tag('glyphicon-random') + ' Events'.html_safe, agent_events_path(@agent, return: request.fullpath) %>
  • <% else %>
  • Events
  • @@ -103,7 +103,7 @@ <% if @agent.can_create_events? %>

    Events created: - <%= link_to @agent.events.count, agent_events_path(@agent) %> + <%= link_to @agent.events_count, agent_events_path(@agent) %>

    <% end %>