Module: Enumerize::ActiveModelAttributesSupport

Defined in:
lib/enumerize/activemodel.rb

Defined Under Namespace

Modules: InstanceMethods Classes: Type

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/activemodel.rb', line 5

def enumerize(name, options={})
  super

  _enumerize_module.dependent_eval do
    if self.included_modules.include? ::ActiveModel::Attributes
      include InstanceMethods

      attribute name, Enumerize::ActiveModelAttributesSupport::Type.new(enumerized_attributes[name])
    end
  end
end