Forum: Ruby on Rails Correct location for ActionMailer interceptor

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
B51f0d8453e1edfe3839630ed7ffd16e?d=identicon&s=25 Cody Skidmore (cody_skidmore)
on 2015-06-26 16:52
(Received via mailing list)
I read the Rails documentation for creating an email interceptor. It
mentions putting the registration in config/initializers, However,
no mention about where I should store the interceptor itself. What is
best practice for this?
75caea9632dfb35b8259dd6e4e4772c6?d=identicon&s=25 Elizabeth McGurty (Guest)
on 2015-06-27 14:38
(Received via mailing list)
To get started:

For Rails 3,

Railscasts: #206 Action Mailer in Rails 3

At Github, Rails ActionMailer, the interceptor test file is pretty
interesting, around line 642
B51f0d8453e1edfe3839630ed7ffd16e?d=identicon&s=25 Cody Skidmore (cody_skidmore)
on 2015-06-27 15:44
(Received via mailing list)
Thank you Elizabeth. I'm new to Rails so poking around in the Rails
is insightful.

Usually the test case is a good guide for how to use a piece of code.
interceptor is declared right inside the test case. The documentation
the test seem to imply that I should declare the interceptor and the
registration in the same file and place it inside the initializers

I'm implementing an email interceptor that redirects outbound email to a
testing email account during development, so I added an interceptors
under config and put the registration in development.rb. This seems a
sensible place for interceptors to live. It also registers the
only under the right circumstance.

Feedback about this is appreciated,
This topic is locked and can not be replied to.