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