# Rescue\_from ActionController::MethodNotAllowed

**URL:** <https://www.ruby-forum.com/t/rescue-from-actioncontroller-methodnotallowed/144786>\
**Category:** Rails\
**Created:** [August 2, 2008, 1:07am UTC](https://www.ruby-forum.com/t/rescue-from-actioncontroller-methodnotallowed/144786 "2008-08-02T01:07:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vineire77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e9c0ed/32.png) [@vineire77](https://www.ruby-forum.com/u/vineire77)\
**Post date:** [August 2, 2008, 1:07am UTC](https://www.ruby-forum.com/t/rescue-from-actioncontroller-methodnotallowed/144786/1 "2008-08-02T01:07:52Z")

</div>

Hello,

I’m having some trouble handing ActionController::MethodNotAllowed  
errors. Basically, the following is defined in my controllers, but  
obviously I’m missing something. Thanks in advance for any light you  
can shed.

* * *

class UsersController \< ApplicationController  
rescue\_from ActionController::MethodNotAllowed, :with  
=\> :not\_allowed

def not\_allowed  
flash[:message] = “The action you requested is not supported.”  
redirect\_to welcome\_path  
end

---

<div class="post-metadata">

**Author:** ![vineire77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e9c0ed/32.png) [@vineire77](https://www.ruby-forum.com/u/vineire77)\
**Post date:** [August 2, 2008, 1:56am UTC](https://www.ruby-forum.com/t/rescue-from-actioncontroller-methodnotallowed/144786/2 "2008-08-02T01:56:59Z")

</div>

By the way, the trouble I’m having is that the error is not being  
handled by ‘not\_allowed’… 🙂

---

<div class="post-metadata">

**Author:** ![vineire77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e9c0ed/32.png) [@vineire77](https://www.ruby-forum.com/u/vineire77)\
**Post date:** [August 2, 2008, 4:21pm UTC](https://www.ruby-forum.com/t/rescue-from-actioncontroller-methodnotallowed/144786/3 "2008-08-02T16:21:15Z")

</div>

I have used rescue\_from and this looks fine to me.

But twist in the tale I found while googling for the same.  
I think you are looking for this:  
[http://rails.lighthouseapp.com/projects/8994/tickets/744-rescue\_from-routing-errors](http://rails.lighthouseapp.com/projects/8994/tickets/744-rescue_from-routing-errors)

Though I think Pratik has solved this issue:  
[http://m.onkey.org/tags/actionpack](http://m.onkey.org/tags/actionpack)

may be helpful for you

-Gourav

---

<div class="post-metadata">

**Author:** ![vineire77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e9c0ed/32.png) [@vineire77](https://www.ruby-forum.com/u/vineire77)\
**Post date:** [August 3, 2008, 6:46am UTC](https://www.ruby-forum.com/t/rescue-from-actioncontroller-methodnotallowed/144786/4 "2008-08-03T06:46:23Z")

</div>

Thank you, Gourav… I’ll check it out.
