123456789_123456789_123456789_123456789_123456789_

Module: ActionController::HideActions::ClassMethods

Relationships & Source Files
Defined in: actionpack/lib/action_controller/metal/hide_actions.rb

Instance Method Summary

Instance Method Details

#action_methods

Overrides AbstractController::Base#action_methods to remove any methods that are listed as hidden methods.

[ GitHub ]

  
# File 'actionpack/lib/action_controller/metal/hide_actions.rb', line 35

def action_methods
  @action_methods ||= Set.new(super.reject { |name| hidden_actions.include?(name) }).freeze
end

#hide_action(*args)

Sets all of the actions passed in as hidden actions.

Parameters

  • args - A list of actions

[ GitHub ]

  
# File 'actionpack/lib/action_controller/metal/hide_actions.rb', line 25

def hide_action(*args)
  self.hidden_actions = hidden_actions.dup.merge(args.map(&:to_s)).freeze
end

#visible_action?(action_name) ⇒ Boolean

[ GitHub ]

  
# File 'actionpack/lib/action_controller/metal/hide_actions.rb', line 29

def visible_action?(action_name)
  not hidden_actions.include?(action_name)
end