aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/new_base/hide_actions.rb
diff options
context:
space:
mode:
authorYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-06-10 15:27:53 -0700
committerYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-06-10 15:27:53 -0700
commit47ff57f6d14fe161900bf85e2d2cf6d7e21a1eb8 (patch)
tree66027df07caa23ef31a0258a94e45fbe1fcf35d7 /actionpack/lib/action_controller/new_base/hide_actions.rb
parent82a10ce9f61a02a97d85915bb5fca53730ae28c8 (diff)
downloadrails-47ff57f6d14fe161900bf85e2d2cf6d7e21a1eb8.tar.gz
rails-47ff57f6d14fe161900bf85e2d2cf6d7e21a1eb8.tar.bz2
rails-47ff57f6d14fe161900bf85e2d2cf6d7e21a1eb8.zip
Document and clean up HideActions and Http
Diffstat (limited to 'actionpack/lib/action_controller/new_base/hide_actions.rb')
-rw-r--r--actionpack/lib/action_controller/new_base/hide_actions.rb19
1 files changed, 10 insertions, 9 deletions
diff --git a/actionpack/lib/action_controller/new_base/hide_actions.rb b/actionpack/lib/action_controller/new_base/hide_actions.rb
index 86852a26cd..af68c772b1 100644
--- a/actionpack/lib/action_controller/new_base/hide_actions.rb
+++ b/actionpack/lib/action_controller/new_base/hide_actions.rb
@@ -8,26 +8,27 @@ module ActionController
extlib_inheritable_accessor(:hidden_actions) { Set.new }
end
- def action_methods
- self.class.action_methods
- end
-
private
+ # Overrides AbstractController::Base#action_method? to return false if the
+ # action name is in the list of hidden actions.
def action_method?(action_name)
!hidden_actions.include?(action_name) && super
end
module ClassMethods
- # Sets
+ # Sets all of the actions passed in as hidden actions.
+ #
+ # ==== Parameters
+ # *args<#to_s>:: A list of actions
def hide_action(*args)
- args.each do |arg|
- self.hidden_actions << arg.to_s
- end
+ hidden_actions.merge(args.map! {|a| a.to_s })
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| self.hidden_actions.include?(name.to_s)})
+ @action_methods ||= Set.new(super.reject {|name| hidden_actions.include?(name)})
end
end
end