Class: CarnivalEnumInput

Inherits:
SimpleForm::Inputs::CollectionSelectInput
  • Object
show all
Defined in:
app/inputs/carnival_enum_input.rb

Instance Method Summary collapse

Instance Method Details

#constant_nameObject



16
17
18
# File 'app/inputs/carnival_enum_input.rb', line 16

def constant_name
  "#{attribute_name.upcase}_ENUM"
end

#get_collectionObject



12
13
14
# File 'app/inputs/carnival_enum_input.rb', line 12

def get_collection
  object.class.const_get(constant_name)
end

#input(wrapper_options = nil) ⇒ Object



3
4
5
6
# File 'app/inputs/carnival_enum_input.rb', line 3

def input(wrapper_options = nil)
  options[:collection] ||= get_collection
  super()
end

#input_html_classesObject



8
9
10
# File 'app/inputs/carnival_enum_input.rb', line 8

def input_html_classes
  super.push('form-control')
end