Permalink
Browse files

Merge pull request #34 from oggy/master

Collection of fixes for ruby 1.9 and mysql2
  • Loading branch information...
lukemelia committed May 10, 2011
2 parents 5af9fc7 + 46b1b54 commit 1698c26ddbad7a7d30d93b5ce616ee00a8debee7
@@ -19,7 +19,7 @@ def filtered_backtrace
def root_for_backtrace_filtering(sub_path = nil)
if defined?(Rails) && Rails.respond_to?(:root)
- sub_path ? Rails.root.join(sub_path) : Rails.root
+ (sub_path ? Rails.root.join(sub_path) : Rails.root).to_s
else
root = if defined?(RAILS_ROOT)
RAILS_ROOT
@@ -7,12 +7,15 @@ class TemplatesPanel < Panel
autoload :Trace, "rack/bug/panels/templates_panel/trace"
autoload :Rendering, "rack/bug/panels/templates_panel/rendering"
- def self.record(template, &block)
- return block.call unless Rack::Bug.enabled?
+ def self.record(template)
+ return yield unless Rack::Bug.enabled?
template_trace.start(template)
- result = block.call
- template_trace.finished(template)
+ begin
+ result = yield
+ ensure
+ template_trace.finished(template)
+ end
return result
end
View
@@ -1,3 +1,4 @@
+# encoding: utf-8
require "erb"
module Rack
@@ -13,8 +13,14 @@
<table class="sortable">
<thead>
<tr>
- <% result.fetch_fields.each do |field| %>
- <th><%= field.name.upcase %></th>
+ <% if defined?(Mysql2) %>
+ <% result.fields.each do |field| %>
+ <th><%= field.upcase %></th>
+ <% end %>
+ <% else %>
+ <% result.fetch_fields.each do |field| %>
+ <th><%= field.name.upcase %></th>
+ <% end %>
<% end %>
</tr>
</thead>
@@ -13,10 +13,16 @@
<table class="sortable">
<thead>
<tr>
- <% result.fetch_fields.each do |field| %>
- <th><%= field.name.upcase %></th>
+ <% if defined?(Mysql2) %>
+ <% result.fields.each do |field| %>
+ <th><%= field.upcase %></th>
+ <% end %>
+ <% else %>
+ <% result.fetch_fields.each do |field| %>
+ <th><%= field.name.upcase %></th>
+ <% end %>
<% end %>
- </tr>
+ </tr>
</thead>
<tbody>
<% i = 1 %>
@@ -13,8 +13,14 @@
<table class="sortable">
<thead>
<tr>
- <% result.fetch_fields.each do |field| %>
- <th><%= field.name.upcase %></th>
+ <% if defined?(Mysql2) %>
+ <% result.fields.each do |field| %>
+ <th><%= field.upcase %></th>
+ <% end %>
+ <% else %>
+ <% result.fetch_fields.each do |field| %>
+ <th><%= field.name.upcase %></th>
+ <% end %>
<% end %>
</tr>
</thead>

0 comments on commit 1698c26

Please sign in to comment.