4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/enumerate_it/class_methods.rb', line 4
def has_enumeration_for(attribute, options = {})
self.enumerations = self.enumerations.dup
define_enumeration_class attribute, options
create_enumeration_humanize_method options[:with], attribute
store_enumeration options[:with], attribute
unless options[:skip_validation]
set_validations attribute, options
end
if options[:create_helpers]
create_helper_methods options[:with], attribute, options[:create_helpers]
create_mutator_methods options[:with], attribute, options[:create_helpers]
create_polymorphic_methods options[:with], attribute, options[:create_helpers]
end
if options[:create_scopes]
create_scopes options[:with], attribute, options[:create_scopes]
end
end
|