Only load the fields we need for the autocomplete.

Andrew Cantino 10 年 前
コミット
bca562513b
共有1 個のファイルを変更した1 個の追加1 個の削除を含む
  1. 1 1
      app/views/layouts/application.html.erb

+ 1 - 1
app/views/layouts/application.html.erb

@@ -36,7 +36,7 @@
36 36
     <script>
37 37
       var agentPaths = {};
38 38
       <% if current_user -%>
39
-        var myAgents = <%= Utils.jsonify(current_user.agents.inject({}) {|m, a| m[a.name] = agent_path(a) unless a.new_record?; m }) %>;
39
+        var myAgents = <%= Utils.jsonify(current_user.agents.select([:name, :id, :schedule]).inject({}) {|m, a| m[a.name] = agent_path(a); m }) %>;
40 40
         $.extend(agentPaths, myAgents);
41 41
       <% end -%>
42 42
       agentPaths["All Agents Index"] = <%= Utils.jsonify agents_path %>;