aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/filters.rb
diff options
context:
space:
mode:
authorSven Fuchs <svenfuchs@artweb-design.de>2008-08-21 19:04:39 +0200
committerSven Fuchs <svenfuchs@artweb-design.de>2008-08-21 19:04:39 +0200
commitaad429a46e3017fa7ca73f58428693e821be42b6 (patch)
treef749e0cdeab20c7f4be37ff49e064705f17cdfa5 /actionpack/lib/action_controller/filters.rb
parentcf6840773b4f5046151f4d28c286069aabaafa10 (diff)
parent8622787f8748434b4ceb2b925a35b17a38e1f2d6 (diff)
downloadrails-aad429a46e3017fa7ca73f58428693e821be42b6.tar.gz
rails-aad429a46e3017fa7ca73f58428693e821be42b6.tar.bz2
rails-aad429a46e3017fa7ca73f58428693e821be42b6.zip
Merge branch 'master' into i18n
Diffstat (limited to 'actionpack/lib/action_controller/filters.rb')
-rw-r--r--actionpack/lib/action_controller/filters.rb19
1 files changed, 16 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/filters.rb b/actionpack/lib/action_controller/filters.rb
index 10dc0cc45b..1d7236f18a 100644
--- a/actionpack/lib/action_controller/filters.rb
+++ b/actionpack/lib/action_controller/filters.rb
@@ -109,16 +109,17 @@ module ActionController #:nodoc:
update_options! options
end
+ # override these to return true in appropriate subclass
def before?
- self.class == BeforeFilter
+ false
end
def after?
- self.class == AfterFilter
+ false
end
def around?
- self.class == AroundFilter
+ false
end
# Make sets of strings from :only/:except options
@@ -170,6 +171,10 @@ module ActionController #:nodoc:
:around
end
+ def around?
+ true
+ end
+
def call(controller, &block)
if should_run_callback?(controller)
method = filter_responds_to_before_and_after? ? around_proc : self.method
@@ -212,6 +217,10 @@ module ActionController #:nodoc:
:before
end
+ def before?
+ true
+ end
+
def call(controller, &block)
super
if controller.send!(:performed?)
@@ -224,6 +233,10 @@ module ActionController #:nodoc:
def type
:after
end
+
+ def after?
+ true
+ end
end
# Filters enable controllers to run shared pre- and post-processing code for its actions. These filters can be used to do