Module: EnumerateIt::ClassMethods

Defined in:
lib/enumerate_it.rb

Instance Method Summary collapse

Instance Method Details

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



200
201
202
203
204
205
206
207
208
209
# File 'lib/enumerate_it.rb', line 200

def has_enumeration_for(attribute, options = {})
  define_enumeration_class attribute, options
  if self.respond_to? :validates_inclusion_of
    validates_inclusion_of attribute, :in => options[:with].list, :allow_blank => true
  end
  create_enumeration_humanize_method options[:with], attribute
  if options[:create_helpers]
    create_helper_methods options[:with], attribute
  end
end