title: Handling exception in Rails in dev/production mode
body: <p>For handling exceptions I decided to use <code>Exception_notifier</code> gem. Here is the code I use in <code>/config/enviroments/development.rb</code></p>
  
  <pre><code>  config.middleware.use ExceptionNotifier,
      :email_prefix =&gt; "[ERROR] ",
      :sender_address =&gt; '"dev-Notifier" &lt;error@my_emails.com&gt;',
      :exception_recipients =&gt; ['error@my_emails.com']
  </code></pre>
  
  <p>If I make some syntax failure, for example:</p>
  
  <pre><code>@article = Article.fixnd(params[:id])
  </code></pre>
  
  <p>I will receive the error email about it.</p>
  
  <p>But if I set to the URL line this address:</p>
  
  <pre><code>http://localhost:3001/articlesssssss
  </code></pre>
  
  <p>I'll get an error, but the email is not sent. The same behavior if I set to the url bad address (404 error).</p>
  
  <p>What I have to set up, if I would like to receive email about every error in the app (also about the last 2 errors above)?</p>
  
  <p>This is the part I use in <code>ApplicationController</code>:</p>
  
  <pre><code>  unless Rails.application.config.consider_all_requests_local
      rescue_from Exception, with: :render_500
      rescue_from ActionController::RoutingError, with: :render_404
      rescue_from ActionController::UnknownController, with: :render_404
      rescue_from ActionController::UnknownAction, with: :render_404
      rescue_from ActiveRecord::RecordNotFound, with: :render_404
    end
  </code></pre>