- Around_filter: around_action_filter
- Protected
- Def transaction
- Ret = true
- Activerecord: Base. Transaction do
- Begin
- Yield if block_given?
- Rescue exception => ex
- Set_notice (ex. Message)
- Ret = ex. Message
- Raise activerecord: rollback, Ex. Message
- End
- End
- Return ret
- End
- Def around_action_filter
- Return yield if request. Get?
- Redirect_to (: controller => "error_display",: Action => "error_notice") if
- Transaction {yield if block_given? }! = True
- End
Around_filter: around_action_filter </P> <p> protected <br/> def transaction <br/> ret = true </P> <p> activerecord: base. transaction DO <br/> begin <br/> yield if block_given? <Br/> rescue exception => ex <br/> set_notice (ex. message) <br/> ret = ex. message <br/> raise activerecord: rollback, Ex. message <br/> end </P> <p> return ret <br/> end </P> <p> def around_action_filter <br/> return yield if request. get? <Br/> redirect_to (: controller => "error_display",: Action => "error_notice") if <br/> transaction {yield if block_given? }! = True <br/> end
This is the processing code written in applicationcontroller. The set_notice only Sets flash [: Notice] to be displayed on the error_notice page.