NoMethodError in Messages and rescue_from

I’am not able to catch ActionController::NoMethodError so I can
display a own error message site.

Can someone give me a peace of code to check it?

How do you catch such errors and ActiveRecord:… error to display a
own error message site?


Jochen

I’m not sure I understand you correctly (you state you’re “not able”
to catch Exceptions) but rescue_action/rescue_action_in_public was
made exactly for this:

http://api.rubyonrails.org/classes/ActionController/Rescue.html

Rails 2.0 adds rescue_from to handle different exceptions with
different handlers:
http://api.rubyonrails.org/classes/ActionController/Rescue/ClassMethods.html

Jochen K. schrieb:

Am 25.12.2007 um 19:28 schrieb Java:

I’m not sure I understand you correctly (you state you’re “not able”
to catch Exceptions) but rescue_action/rescue_action_in_public was
made exactly for this:

http://api.rubyonrails.org/classes/ActionController/Rescue.html

Rails 2.0 adds rescue_from to handle different exceptions with
different handlers:
http://api.rubyonrails.org/classes/ActionController/Rescue/ClassMethods.html

Can you give me please a example how to display a own error page
when a ActionController:NoMethodError occurs?

Thanx


Jochen K.

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