title: Render a status code when an error occured
body: <p>When someone accesses my API with something different than an integer value, it should return a 400 Error.</p>
  
  <p>My minimalized index method is:</p>
  
  <pre><code>def index
      @returnType = MyType.all
  
      if params["limit"].present?
          begin
              limit = Integer(limit)
          rescue Exception=&gt;e
              render status: :bad_request
          end
       end
  
      respond_to do |format|
          format.json
      end
  end
  </code></pre>
  
  <p>But, in the exception-case I get a <code>AbstractController::DoubleRenderError</code>.</p>
  
  <p>The problem is, Rails doesn't stop the method at <code>render</code>, it continued with the <code>respond_to</code> part.</p>