Hi, ok let say I have 3 actions in some controller
def first_action
do_something
rescue Exception => exc
error_action(exc)
end
def second_action
do_something_again
rescue Exception => exc
error_action(exc)
end
def third_action
do_a_little_bit_of_somthing_here
rescue Exception => exc
error_action(exc)
end
protected
def error_action(msg)
flash[“notice”] = msg
redirect_to :action => “index”
end
Question is is there a better way writing this
rescue Exception => exc
error_action(exc)
so that it doesn’t repeat and I don’t have to write it in every method
(something like define at one place and automatically the methods know
what to do on exceptions)
Thanks in advance