anusuya
anusuya

Reputation: 653

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_action_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

Upvotes: 1

Views: 797

Answers (1)

pjammer
pjammer

Reputation: 9577

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.

Upvotes: 1

Related Questions