saasbook

around_filter_example.rb

May 1st, 2012
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.28 KB | None | 0 0
  1. # somewhat contrived example of an around-filter
  2. around_filter :only => ['withdraw_money', 'transfer_money'] do
  3.   # log who is trying to move money around
  4.   start = Time.now
  5.   yield   # do the action
  6.   # note how long it took
  7.   logger.info params
  8.   logger.info (Time.now - start)
  9. end
Advertisement
Add Comment
Please, Sign In to add comment