Permalink
Browse files

Use Rails' backtrace silencers to clean the trace.

  • Loading branch information...
1 parent 9ce6f2e commit e8a6b49ea9fb8e680663e051789fdd33eb336eaa @archfear archfear committed with Dec 17, 2009
Showing with 3 additions and 4 deletions.
  1. +3 −4 lib/query_trace.rb
View
7 lib/query_trace.rb
@@ -37,10 +37,9 @@ def format_trace(trace)
end
end
- VENDOR_RAILS_REGEXP = %r(([\\/:])vendor\1rails\1)
def clean_trace(trace)
- return trace unless defined?(RAILS_ROOT)
-
- trace.select{|t| /#{Regexp.escape(File.expand_path(RAILS_ROOT))}/ =~ t}.reject{|t| VENDOR_RAILS_REGEXP =~ t}.collect{|t| t.gsub(RAILS_ROOT + '/', '')}
+ Rails.respond_to?(:backtrace_cleaner) ?
+ Rails.backtrace_cleaner.clean(trace) :
+ trace
end
end

0 comments on commit e8a6b49

Please sign in to comment.