Plugin class seen from environment.rb but not production.rb!


I’m trying to add in the Exception Notification plugin described in
Rails Recipe #47.

I add the following to my environment.rb file:

#ExceptionNotifier configuration
ExceptionNotifier.exception_recipients = %w(blah blah)
ExceptionNotifier.sender_address = %(“Application Error”
[email protected])
ExceptionNotifier.email_prefix = “[ESimplyOnline]”

Then I add the following to my production.rb file to add another
recipient to the list of recipients.

ExceptionNotifier.exception_recipients << %([email protected])

This entry in production.rb generates a

`const_missing’: uninitialized constant ExceptionNotifier (NameError)

when I try to start up Rails. If I remove it, Rails starts fine. So I
know that the entry in environments.rb is ok.

I am using Apache in conjunction with dispatch.fcgi. Does the
production.rb file load without knowledge of the plugins?

Should I enhance the ExceptionNotifier.exception_recipients array in
application.rb instead?


I never figured this out, Mike, sorry.

Did you ever figure this out? I’m running into the same thing when I
tried to put it into one of the specific environments and not the
global environment.rb. I’d like to not have it send mail in
development mode. I did see a post saying it did not do that anyway,
but I’m not exactly sure.

Thanks for your time,


Mike Vargo

On Sep 12 2006, 2:25 pm, Wes G. [email protected]

Wes G. wrote:

I never figured this out, Mike, sorry.

Put this in the specific environment file as follows:

config.after_initialize do
ExceptionNotifier.exception_recipients = #…

When the environment files are being loaded, you can’t assume that the
Rails environment (including plugins) has been fully loaded, thus the
config.after_initialize feature.

Brian H.