title: Ruby-on-Rails: How to get rid of "you are being redirected" page
body: <p>I am overriding Devise's failure response so that I can set a 401 status code. However, when the user fails to sign in, they are redirected to a page with a "you are being redirected" link. If I remove this <code>:status => 401</code> from the redirect it works fine. </p>
  
  <pre><code>class CustomFailure &lt; Devise::FailureApp
      def redirect_url
        new_user_session_url(:subdomain =&gt; 'secure')
      end
  
      def respond
          if http_auth?
             http_auth
          else
             store_location!
             flash[:alert] = i18n_message unless flash[:notice]
             redirect_to redirect_url, :status =&gt; 401
          end
      end
  end
  </code></pre>
  
  <h2>edit</h2>
  
  <p>Alternatively I would like to display the flash message and remain on the same page but adding this line of code: </p>
  
  <pre><code>render :text =&gt; "unauthorized", :status =&gt; 401
  </code></pre>
  
  <p>causes ruby to complain: </p>
  
  <pre><code>undefined method `render' for #&lt;CustomFailure:0x00000103367f28&gt;
  </code></pre>
  
  <p>What's happening here?</p>