Module: Mongoid::Document::Roleable

Defined in:
lib/mongoid-simple-roles.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/mongoid-simple-roles.rb', line 4

def self.included(base)
  base.class_eval do |klass|
    klass.field :roles, :type => Array
    klass.index({ roles: 1 }, { background: true })

    include InstanceMethods
    extend ClassMethods
  end
end