From ae9f803c5dfbc06701de87b804250b591fac2d20 Mon Sep 17 00:00:00 2001 From: Lauro Caetano Date: Tue, 1 Apr 2014 14:40:04 -0300 Subject: 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). --- actionpack/lib/abstract_controller/callbacks.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'actionpack/lib/abstract_controller') 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 :only => :index gets converted to # :if => proc {|c| c.action_name == "index" }. # + # Note that :only has priority over :if in case they + # are used together. + # + # only: :index, if: -> { true } # the :if option will be ignored. + # # ==== Options # * only - The callback should be run only for this action # * except - The callback should be run for all actions except this action -- cgit v1.2.3