aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/abstract_controller
diff options
context:
space:
mode:
authorLauro Caetano <laurocaetano1@gmail.com>2014-04-01 14:40:04 -0300
committerclaudiob <claudiob@gmail.com>2015-01-08 09:13:45 -0800
commitae9f803c5dfbc06701de87b804250b591fac2d20 (patch)
tree7afb443641ba7a8e6fa3ce6310d60ccff83fb63b /actionpack/lib/abstract_controller
parent0e8c7ff7f7988e9b0bfae91ca4f27b200f8f6541 (diff)
downloadrails-ae9f803c5dfbc06701de87b804250b591fac2d20.tar.gz
rails-ae9f803c5dfbc06701de87b804250b591fac2d20.tar.bz2
rails-ae9f803c5dfbc06701de87b804250b591fac2d20.zip
Add test case and documentation for skip_before_filter.
Test case for using skip_before_filter with the options :only and :if both present. In this case, the :if option will be ignored and :only will be executed. Closes #14549 (the commit was cherry-picked from there).
Diffstat (limited to 'actionpack/lib/abstract_controller')
-rw-r--r--actionpack/lib/abstract_controller/callbacks.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/actionpack/lib/abstract_controller/callbacks.rb b/actionpack/lib/abstract_controller/callbacks.rb
index 32de82780f..865bd6bbe0 100644
--- a/actionpack/lib/abstract_controller/callbacks.rb
+++ b/actionpack/lib/abstract_controller/callbacks.rb
@@ -28,6 +28,11 @@ module AbstractController
# The basic idea is that <tt>:only => :index</tt> gets converted to
# <tt>:if => proc {|c| c.action_name == "index" }</tt>.
#
+ # Note that <tt>:only</tt> has priority over <tt>:if</tt> in case they
+ # are used together.
+ #
+ # only: :index, if: -> { true } # the :if option will be ignored.
+ #
# ==== Options
# * <tt>only</tt> - The callback should be run only for this action
# * <tt>except</tt> - The callback should be run for all actions except this action