Skip to content

Environmental Behavior

triemstr edited this page Sep 13, 2010 · 2 revisions

Email notifications will only occur when the IP address is determined not to
be local. You can specify certain addresses to always be local so that you’ll
get a detailed error instead of the generic error page. You do this in your
controller (or even per-controller):

consider_local "64.72.18.143", "14.17.21.25"

You can specify subnet masks as well, so that all matching addresses are
considered local:

consider_local "64.72.18.143/24"

The address “127.0.0.1” is always considered local. If you want to completely
reset the list of all addresses (for instance, if you wanted “127.0.0.1” to
NOT be considered local), you can simply do, somewhere in your controller:

local_addresses.clear

To turn on development, add this to your controller as well:

self.exception_notifiable_noisy_environments = ["development", "production"]

Last step for development, you may also need to set this variable in your
config/environments/development.rb file:

config.action_controller.consider_all_requests_local = false

If you set the above variable, you will no longer have errors reported to screen in
development, but it can help you test super exception notification.