Skip to content

Creating and Handling Exceptions in Rails

It took a little bit, but I finally got the error handling to work just the way I wanted it to:

  def rescue_action_in_public(e)
    case e
      when Exception::UnauthorizedAction
        redirect_to :controller => 'main', :action => 'unauthorized_action'  and return false
        return super

This approach basically allows you to ‘extend’ the base ActionController.rescue_action_in_public() method.

Posted in Rails, Ruby, Software Development, Tips and Tricks.

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

or, reply to this post via trackback.