How to catch Mysql::Error exception in the application controller in rails 2.3.8
Am upgrading Rails 2.1.1 to rails 2.3.8. Previously i was able to catch Mysql::Error in the rescue_action_in_public method defined in application_controller. After upgrading to 2.3.8 version, the 'rescue_act开发者_运维知识库ion_in_public' is not being called at all. What should i do to catch the Mysql::Error exception in my application controller.
Any help very much appreciated.
Thanks
You could use rescue_from ActiveRecord::RecordNotFound, :with => :deny_access
and then make a method def deny_access; flash[:error] = "not this time"; redirect_to root_url; end
Whether rescue_action_in_public did more, i don't know.
精彩评论