aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2007-05-06 04:10:26 +0000
committerMichael Koziarski <michael@koziarski.com>2007-05-06 04:10:26 +0000
commit67ca9224d709e28bfd5802b1f44969d621b0ea8f (patch)
treec5d970f3f65aaca597f762ed3e6d58076ebf2b46 /actionpack/lib
parente64236882919a6696ff64a4e3e736955b4d09753 (diff)
downloadrails-67ca9224d709e28bfd5802b1f44969d621b0ea8f.tar.gz
rails-67ca9224d709e28bfd5802b1f44969d621b0ea8f.tar.bz2
rails-67ca9224d709e28bfd5802b1f44969d621b0ea8f.zip
Bug fix for the filter implementation
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6669 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/filters.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/filters.rb b/actionpack/lib/action_controller/filters.rb
index 3543c80ec9..d87df2577c 100644
--- a/actionpack/lib/action_controller/filters.rb
+++ b/actionpack/lib/action_controller/filters.rb
@@ -527,6 +527,8 @@ module ActionController #:nodoc:
end
def find_filter_append_position(filters, filter_type)
+ # appending an after filter puts it at the end of the call chain
+ # before and around filters goe before the first after filter in the chain
unless filter_type == :after
filter_chain.each_with_index do |f,i|
return i if f.after?
@@ -536,10 +538,13 @@ module ActionController #:nodoc:
end
def find_filter_prepend_position(filters, filter_type)
+ # prepending a before or around filter puts it at the front of the call chain
+ # after filters go before the first after filter in the chain
if filter_type == :after
filter_chain.each_with_index do |f,i|
return i if f.after?
end
+ return -1
end
return 0
end
@@ -684,9 +689,9 @@ module ActionController #:nodoc:
def call_filters(chain, index, nesting)
# run before filters until we find an after filter or around filter
- while true
+ while chain[index]
filter, index = skip_excluded_filters(chain, index)
- break unless filter
+ break unless filter # end of call chain reached
case filter.type
when :before
# invoke before filter
@@ -710,8 +715,9 @@ module ActionController #:nodoc:
return index if aborted || nesting != 0
# run after filters, if any
- while filter = chain[index]
+ while chain[index]
filter, index = skip_excluded_filters(chain, index)
+ break unless filter
case filter.type
when :after
filter.run(self)