diff options
author | Yehuda Katz <wycats@gmail.com> | 2009-03-12 13:19:13 -0600 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2009-03-12 13:19:13 -0600 |
commit | a2637e9f1fba92bc0b8dbf461ce9f4f8ffb4cfaa (patch) | |
tree | 21207daf4fd7dd7dc77930b934b900b1d1d6e2f0 /actionpack/lib/action_controller/new_base/hide_actions.rb | |
parent | 67f9b39bd05678881e200ddeed02b2bce9744ac8 (diff) | |
download | rails-a2637e9f1fba92bc0b8dbf461ce9f4f8ffb4cfaa.tar.gz rails-a2637e9f1fba92bc0b8dbf461ce9f4f8ffb4cfaa.tar.bz2 rails-a2637e9f1fba92bc0b8dbf461ce9f4f8ffb4cfaa.zip |
Try to build a new AC::Base on top of AbstractController
Diffstat (limited to 'actionpack/lib/action_controller/new_base/hide_actions.rb')
-rw-r--r-- | actionpack/lib/action_controller/new_base/hide_actions.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/new_base/hide_actions.rb b/actionpack/lib/action_controller/new_base/hide_actions.rb new file mode 100644 index 0000000000..9847d7b086 --- /dev/null +++ b/actionpack/lib/action_controller/new_base/hide_actions.rb @@ -0,0 +1,28 @@ +module ActionController + module HideActions + def self.included(klass) + klass.class_eval do + extend ClassMethods + extlib_inheritable_accessor :hidden_actions + self.hidden_actions ||= Set.new + end + end + + def action_methods() self.class.action_names end + def action_names() action_methods end + + module ClassMethods + def hide_action(*args) + args.each do |arg| + self.hidden_actions << arg.to_s + end + end + + def action_methods + @action_names ||= Set.new(super.reject {|name| self.hidden_actions.include?(name.to_s)}) + end + + def self.action_names() action_methods end + end + end +end
\ No newline at end of file |