Use length rather than count when the relation should already be materialized.

Akinori MUSHA преди 10 години
родител
ревизия
06ae684ff7
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      app/helpers/agent_helper.rb

+ 1 - 1
app/helpers/agent_helper.rb

@@ -21,7 +21,7 @@ module AgentHelper
21 21
 
22 22
     controllers = agent.controllers
23 23
     [
24
-      *(CGI.escape_html(agent.schedule.humanize.titleize) unless agent.schedule == 'never' && agent.controllers.count > 0),
24
+      *(CGI.escape_html(agent.schedule.humanize.titleize) unless agent.schedule == 'never' && agent.controllers.length > 0),
25 25
       *controllers.map { |agent| link_to(agent.name, agent_path(agent)) },
26 26
     ].join(delimiter).html_safe
27 27
   end