Created
January 18, 2010 10:25
Revisions
-
tomlea revised this gist
Jan 18, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ def raise_redirect_to(*args) class Redirect < Exception attr_reader :redirect_params def initialize(*args) @redirect_params = args end end -
tomlea created this gist
Jan 18, 2010 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ module RaisableRedirections def self.included(other) other.send(:around_filter, :handle_raisable_redirections) end protected def raise_redirect_to(*args) raise Redirect.new(*args) end private class Redirect < Exception attr_reader :redirect_params def initialize(*args) self.redirect_params = args end end def handle_raisable_redirections begin yield rescue Redirect => r redirect_to *r.redirect_params end end end