Permalink
Browse files

Make the notifier non-reloadable, so it is stable in development. Mak…

…e the inspect-model helper more configurable. Show the current pid and server in the environment section.
  • Loading branch information...
1 parent f1d0ce1 commit 047568e137ce874b183a358d5638d758a887d42e @jamis jamis committed Feb 10, 2006
@@ -33,6 +33,8 @@ class ExceptionNotifier < ActionMailer::Base
@@sections = %w(request session environment backtrace)
cattr_accessor :sections
+ def self.reloadable?; false; end
+
def exception_notification(exception, controller, request, data={})
subject "#{email_prefix}#{controller.controller_name}##{controller.action_name} (#{exception.class}) #{exception.message.inspect}"
@@ -25,24 +25,29 @@ module ExceptionNotifierHelper
APP_PATH = "#{RAILS_ROOT}/app/#{VIEW_PATH}"
def render_section(section)
- summary = render_overridable(section).strip
RAILS_DEFAULT_LOGGER.info("rendering section #{section.inspect}")
+ summary = render_overridable(section).strip
unless summary.blank?
title = render_overridable(:title, :locals => { :title => section }).strip
"#{title}\n\n#{summary.gsub(/^/, " ")}\n\n"
end
end
def render_overridable(partial, options={})
- if File.exist?("#{APP_PATH}/_#{partial}.rhtml")
- render(options.merge(:file => "#{APP_PATH}/_#{partial}.rhtml", :use_full_path => false))
+ if File.exist?(path = "#{APP_PATH}/_#{partial}.rhtml")
+ render(options.merge(:file => path, :use_full_path => false))
+ elsif File.exist?(path = "#{File.dirname(__FILE__)}/../#{VIEW_PATH}/_#{partial}.rhtml")
+ render(options.merge(:file => path, :use_full_path => false))
else
- render(options.merge(:file => "#{File.dirname(__FILE__)}/../#{VIEW_PATH}/_#{partial}.rhtml", :use_full_path => false))
+ ""
end
end
- def inspect_model_object(model)
- render_overridable(:inspect_model, :locals => { :inspect_model => model })
+ def inspect_model_object(model, locals={})
+ render_overridable(:inspect_model,
+ :locals => { :inspect_model => model,
+ :show_instance_variables => true,
+ :show_attributes => true }.merge(locals))
end
def inspect_value(value)
@@ -2,3 +2,6 @@
<% @request.env.keys.sort.each do |key| -%>
* <%= "%*-s: %s" % [max.length, key, @request.env[key].to_s.strip] %>
<% end -%>
+
+* Process: <%= $$ %>
+* Server : <%= `hostname -s`.chomp %>
@@ -1,12 +1,16 @@
+<% if show_attributes -%>
[attributes]
<% attrs = inspect_model.attributes -%>
<% max = attrs.keys.max { |a,b| a.length <=> b.length } -%>
<% attrs.keys.sort.each do |attr| -%>
* <%= "%*-s: %s" % [max.length, attr, object_to_yaml(attrs[attr]).gsub(/\n/, "\n ")] %>
<% end -%>
+<% end -%>
+<% if show_instance_variables -%>
[instance variables]
<% inspect_model.instance_variables.sort.each do |variable| -%>
<%- next if variable == "@attributes" -%>
* <%= variable %>: <%= inspect_value(inspect_model.instance_variable_get(variable)) %>
<% end -%>
+<% end -%>

0 comments on commit 047568e

Please sign in to comment.