Guest User

Untitled

a guest
Apr 26th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. # When performing a redirect, this callback will be executed first. If the callback
  2. # returns true, then the redirect is followed, otherwise it is not. The request that
  3. # triggered the redirect and the response will be passed into the block. This can be
  4. # used to update any links on the client side.
  5. #
  6. # Example:
  7. #
  8. # author_resource.on_redirect do |req, resp|
  9. # post.author_uri = resp.header['Location']
  10. # end
  11. #
  12. # @block callback<request, response>
  13. # The action to be executed when a request results in a redirect. Yields the
  14. # current request and result objects to the callback.
  15. def on_redirect(&callback)
  16. if block_given?
  17. @on_redirect = callback
  18. else
  19. @on_redirect
  20. end
  21. end
Add Comment
Please, Sign In to add comment