Skip to content

Commit

Permalink
Merge pull request smartinez87#18 from professor/master
Browse files Browse the repository at this point in the history
Clarified how to customize or add a new view
  • Loading branch information
smartinez87 committed Jul 19, 2011
2 parents 24feff3 + 31c9c5e commit 47e4c2b
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,21 @@ access to the following variables:
You can reorder the sections, or exclude sections completely, by altering the
ExceptionNotifier.sections variable. You can even add new sections that
describe application-specific data--just add the section's name to the list
(whereever you'd like), and define the corresponding partial. Then, if your
new section requires information that isn't available by default, make sure
(wherever you'd like), and define the corresponding partial.

#Example with two new added sections
Whatever::Application.config.middleware.use ExceptionNotifier,
:email_prefix => "[Whatever] ",
:sender_address => %{"notifier" <[email protected]>},
:exception_recipients => %w{[email protected]},
:sections => %w{my_section1 my_section2} + ExceptionNotifier::Notifier.default_sections

When you add a new section or customize a section, you need to inform the gem where the views are.
Create an initializer called config/initializers/exception_notifier.rb with the following code:

ExceptionNotifier::Notifier.prepend_view_path File.join(Rails.root, 'app/views')

If your new section requires information that isn't available by default, make sure
it is made available to the email using the exception_data macro:

class ApplicationController < ActionController::Base
Expand Down

0 comments on commit 47e4c2b

Please sign in to comment.