title: When is conditional before_action method executed in Rails application?
body: <p>In the following code, Why is <code>foo_enabled?</code> called for <code>EmployeeController.bar</code> ?</p>
  
  <pre><code>class ApplicationController &lt; ActionControlelr::Base
      before_action :foo, if: :foo_enabled?
      def foo
          puts 'foo called'
      end
  
      def foo_enabled?
          puts 'sleep for 100s !'
          true
      end
  end
  
  class EmployeeController &lt; ApplicationController
       skip_before_action :foo, only: [:bar]
  
       def bar
           puts 'inside bar'
       end
  end
  </code></pre>