Module: Enumerize::MongoidSupport

Defined in:
lib/enumerize/mongoid.rb

Defined Under Namespace

Modules: InstanceMethods

Instance Method Summary collapse

Instance Method Details

#enumerize(name, options = {}) ⇒ Object


5
6
7
8
9
10
11
12
13
14
15
# File 'lib/enumerize/mongoid.rb', line 5

def enumerize(name, options={})
  super

  _enumerize_module.dependent_eval do
    if self < ::Mongoid::Document
      include InstanceMethods

      after_initialize :_set_default_value_for_enumerized_attributes
    end
  end
end