Module: ActiveAcl::Acts::AccessGroup::ClassMethods
- Defined in:
- lib/active_acl/acts_as_access_group.rb
Instance Method Summary collapse
-
#acts_as_access_group(options = {}) ⇒ Object
Extend self with access group capabilites.
Instance Method Details
#acts_as_access_group(options = {}) ⇒ Object
Extend self with access group capabilites. See README for details on usage. Accepts the following options as a hash:
- left_column
-
name of the left column for nested set functionality, default :lft
- right_column
-
name of the right column for nested set functionality, default :rgt
Don’t use ‘left’ and ‘right’ as column names - these are reserved words in most DBMS.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/active_acl/acts_as_access_group.rb', line 17 def acts_as_access_group( = {}) configuration = {:left_column => :lft, :right_column => :rgt, :controller => ActiveAcl::OPTIONS[:default_group_selector_controller], :action => ActiveAcl::OPTIONS[:default_group_selector_action]} configuration.update() if .is_a?(Hash) ActiveAcl::GROUP_CLASSES[self.name] = configuration from_classes = ActiveAcl::GROUP_CLASSES.keys.collect do |x| x.split('::').join('/').underscore.pluralize.to_sym end ActiveAcl::Acl.instance_eval do has_many_polymorphs :requester_groups, {:from => from_classes, :through => :"active_acl/requester_group_links", :rename_individual_collections => true} has_many_polymorphs :target_groups, {:from => from_classes, :through => :"active_acl/target_group_links", :rename_individual_collections => true} end include InstanceMethods extend SingletonMethods end |