Module: Roles::Mongoid::ClassMethods

Defined in:
lib/roles_mongoid/base.rb

Constant Summary collapse

MAP =
{
  :admin_flag   => "field :admin_flag, :type => Boolean",
  :many_roles   => "references_many :many_roles, :stored_as => :array, :class_name => 'Role', :default => []",
  :one_role     => "references_one :one_role, :class_name => 'Role'",
  :roles_mask   => "field :roles_mask, :type => Integer, :default => 1",
  :role_string  => "field :role_string, :type => String",
  :role_strings => "field :role_strings, :type => Array",
  :roles_string => "field :roles_string, :type => String"
}

Instance Method Summary collapse

Instance Method Details

#strategy(name, options = nil) ⇒ Object



27
28
29
30
31
32
# File 'lib/roles_mongoid/base.rb', line 27

def strategy name, options=nil
  if options == :default && MAP[name]
    instance_eval MAP[name] 
  end
  role_strategy name, options
end