Module: ActionController::Filters::InstanceMethods

Defined in:
lib/action_controller/filters.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



351
352
353
354
355
356
357
358
359
360
361
362
# File 'lib/action_controller/filters.rb', line 351

def self.included(base)
  base.class_eval do
    alias_method :perform_action_without_filters, :perform_action
    alias_method :perform_action, :perform_action_with_filters

    alias_method :process_without_filters, :process
    alias_method :process, :process_with_filters

    alias_method :process_cleanup_without_filters, :process_cleanup
    alias_method :process_cleanup, :process_cleanup_with_filters
  end
end

Instance Method Details

#after_actionObject

Calls all the defined after-filter filters, which are added by using “after_filter :method”. If any of the filters return false, no more filters will be executed.



388
389
390
# File 'lib/action_controller/filters.rb', line 388

def after_action #:doc:
  call_filters(self.class.after_filters)
end

#before_actionObject

Calls all the defined before-filter filters, which are added by using “before_filter :method”. If any of the filters return false, no more filters will be executed and the action is aborted.



382
383
384
# File 'lib/action_controller/filters.rb', line 382

def before_action #:doc:
  call_filters(self.class.before_filters)
end

#perform_action_with_filtersObject



364
365
366
367
368
369
370
371
372
373
# File 'lib/action_controller/filters.rb', line 364

def perform_action_with_filters
  before_action_result = before_action

  unless before_action_result == false || performed?
    perform_action_without_filters
    after_action
  end

  @before_filter_chain_aborted = (before_action_result == false)
end

#process_with_filters(request, response, method = :perform_action, *arguments) ⇒ Object

:nodoc:



375
376
377
378
# File 'lib/action_controller/filters.rb', line 375

def process_with_filters(request, response, method = :perform_action, *arguments) #:nodoc:
  @before_filter_chain_aborted = false
  process_without_filters(request, response, method, *arguments)
end