aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-01-07 00:12:43 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2008-01-07 00:12:43 +0000
commit3b13a09e89f4edaf07e77fea6b0fd529485c1ead (patch)
tree874f00d4d3d605e96fe61dd9716ab8a35d45ac47 /actionpack/lib/action_controller
parent2b326a7155ec74c7dad2c7adbd4356976847d411 (diff)
downloadrails-3b13a09e89f4edaf07e77fea6b0fd529485c1ead.tar.gz
rails-3b13a09e89f4edaf07e77fea6b0fd529485c1ead.tar.bz2
rails-3b13a09e89f4edaf07e77fea6b0fd529485c1ead.zip
Filter procs must take 1 or 2 arguments. Raise ArgumentError otherwise.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8583 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/filters.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/filters.rb b/actionpack/lib/action_controller/filters.rb
index d7fb276171..337c489f07 100644
--- a/actionpack/lib/action_controller/filters.rb
+++ b/actionpack/lib/action_controller/filters.rb
@@ -583,10 +583,12 @@ module ActionController #:nodoc:
when filter.respond_to?(:call)
if filter.is_a?(Method)
MethodFilter
- elsif filter.arity == 1
- ProcFilter
else
- ProcWithCallFilter
+ case filter.arity
+ when 1; ProcFilter
+ when 2; ProcWithCallFilter
+ else raise ArgumentError, 'Filter blocks must take one or two arguments.'
+ end
end
when filter.respond_to?(:filter)
ClassFilter