Rescue_from ActionController::MethodNotAllowed


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

By the way, the trouble I’m having is that the error is not being
handled by ‘not_allowed’… :slight_smile:

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:

Though I think Pratik has solved this issue:

may be helpful for you


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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs