Permalink
Browse files

auto_redirect must not crash if there's no redirection info and :excl…

…ude is given.
  • Loading branch information...
1 parent 2184dcf commit 7aae8724922c527e3b0b676d5c359a942e9bd30e @FooBarWidget committed Sep 3, 2008
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/auto_redirection/controller_extensions.rb
View
7 lib/auto_redirection/controller_extensions.rb
@@ -109,11 +109,14 @@ def attempt_auto_redirect
# is supposed to be redirected to matches this regular expression, then
# the browser will be redirected to the default location instead.
def auto_redirect(options = {})
+ # TODO: document that :exclude may also be a Hash, Array or String.
should_redirect_to_default = false
if options[:exclude]
info = get_redirection_information
- should_redirect_to_default = match_exclusion_list(info,
- options[:exclude])
+ if info
+ should_redirect_to_default = match_exclusion_list(info,
+ options[:exclude])
+ end
end
if !should_redirect_to_default
should_redirect_to_default = !attempt_auto_redirect

0 comments on commit 7aae872

Please sign in to comment.