Module: EnumerateIt::ClassMethods

Defined in:
lib/enumerate_it.rb

Instance Method Summary collapse

Instance Method Details

#enumerationsObject



256
257
258
# File 'lib/enumerate_it.rb', line 256

def enumerations
  @@_enumerations ||= {}
end

#has_enumeration_for(attribute, options = {}) ⇒ Object



241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'lib/enumerate_it.rb', line 241

def has_enumeration_for(attribute, options = {})
  define_enumeration_class attribute, options
  set_validations attribute, options
  create_enumeration_humanize_method options[:with], attribute
  store_enumeration options[:with], attribute
  if options[:create_helpers]
    create_helper_methods options[:with], attribute
    create_mutator_methods options[:with], attribute
  end

  if options[:create_scopes]
    create_scopes options[:with], attribute
  end
end