开发者

How to catch Mysql::Error exception in the application controller in rails 2.3.8

开发者 https://www.devze.com 2023-02-01 13:57 出处:网络
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 \'re

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消