From 08d3f0e3b3701fa7f52615e266cad433138314ac Mon Sep 17 00:00:00 2001 From: brainopia Date: Tue, 6 Jan 2015 23:33:31 +0300 Subject: Remove ActionController::HideActions (closes #18336) --- .../lib/action_controller/metal/hide_actions.rb | 40 ---------------------- 1 file changed, 40 deletions(-) delete mode 100644 actionpack/lib/action_controller/metal/hide_actions.rb (limited to 'actionpack/lib/action_controller/metal/hide_actions.rb') diff --git a/actionpack/lib/action_controller/metal/hide_actions.rb b/actionpack/lib/action_controller/metal/hide_actions.rb deleted file mode 100644 index af36ffa240..0000000000 --- a/actionpack/lib/action_controller/metal/hide_actions.rb +++ /dev/null @@ -1,40 +0,0 @@ - -module ActionController - # Adds the ability to prevent public methods on a controller to be called as actions. - module HideActions - extend ActiveSupport::Concern - - included do - class_attribute :hidden_actions - self.hidden_actions = Set.new.freeze - end - - private - - # Overrides AbstractController::Base#action_method? to return false if the - # action name is in the list of hidden actions. - def method_for_action(action_name) - self.class.visible_action?(action_name) && super - end - - module ClassMethods - # Sets all of the actions passed in as hidden actions. - # - # ==== Parameters - # * args - A list of actions - def hide_action(*args) - self.hidden_actions = hidden_actions.dup.merge(args.map(&:to_s)).freeze - end - - def visible_action?(action_name) - not hidden_actions.include?(action_name) - end - - # Overrides AbstractController::Base#action_methods to remove any methods - # that are listed as hidden methods. - def action_methods - @action_methods ||= Set.new(super.reject { |name| hidden_actions.include?(name) }).freeze - end - end - end -end -- cgit v1.2.3