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

**URL:** <https://www.ruby-forum.com/t/plugin-class-seen-from-environment-rb-but-not-production-rb/68478>\
**Category:** Rails\
**Created:** [September 13, 2006, 12:25am UTC](https://www.ruby-forum.com/t/plugin-class-seen-from-environment-rb-but-not-production-rb/68478 "2006-09-13T00:25:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [September 13, 2006, 12:25am UTC](https://www.ruby-forum.com/t/plugin-class-seen-from-environment-rb-but-not-production-rb/68478/1 "2006-09-13T00:25:57Z")

</div>

All,

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”  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid))  
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 \<\< %(removed\_email\_address@domain.invalid)

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?

Thanks,  
Wes

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [January 26, 2007, 6:28am UTC](https://www.ruby-forum.com/t/plugin-class-seen-from-environment-rb-but-not-production-rb/68478/2 "2007-01-26T06:28:54Z")

</div>

I never figured this out, Mike, sorry.

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [January 26, 2007, 12:29am UTC](https://www.ruby-forum.com/t/plugin-class-seen-from-environment-rb-but-not-production-rb/68478/3 "2007-01-26T00:29:35Z")

</div>

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,

Sincerely,

Mike Vargo

On Sep 12 2006, 2:25 pm, Wes G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [July 25, 2008, 6:07pm UTC](https://www.ruby-forum.com/t/plugin-class-seen-from-environment-rb-but-not-production-rb/68478/4 "2008-07-25T18:07:33Z")

</div>

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 = #…  
end

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.
