Parcourir la source

Match smart variables when casting

Andrew Kane il y a 9 ans
Parent
commit
79c3330b8e

+ 1 - 1
app/controllers/blazer/queries_controller.rb

@@ -107,7 +107,7 @@ module Blazer
           if query
             values = @rows.map { |r| r[key] }.compact.uniq
             rows, error, cached_at = @data_source.run_statement(ActiveRecord::Base.send(:sanitize_sql_array, [query.sub("{value}", "(?)"), values]))
-            @boom[key] = Hash[rows.map(&:values)]
+            @boom[key] = Hash[rows.map(&:values).map { |k, v| [k.to_s, v] }]
           end
         end
 

+ 1 - 1
app/views/blazer/queries/run.html.erb

@@ -104,7 +104,7 @@
                         <%= blazer_format_value(k, v) %>
                       <% end %>
 
-                      <% if v2 = (@boom[k] || {})[v] %>
+                      <% if v2 = (@boom[k] || {})[v.to_s] %>
                         <div class="text-muted"><%= v2 %></div>
                       <% end %>
                     <% end %>