Module: EnumerateIt::ClassMethods

Defined in:
lib/enumerate_it/class_methods.rb

Instance Method Summary collapse

Instance Method Details

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



3
4
5
6
7
8
9
10
11
12
# File 'lib/enumerate_it/class_methods.rb', line 3

def has_enumeration_for(attribute, options = {})
  self.enumerations = enumerations.dup

  define_enumeration_class(attribute, options)
  create_enumeration_humanize_method(options[:with], attribute)
  create_enumeration_key_method(options[:with], attribute)
  store_enumeration(options[:with], attribute)

  handle_options(attribute, options)
end