Class: CarnivalEnumInput
- Inherits:
-
SimpleForm::Inputs::CollectionSelectInput
- Object
- SimpleForm::Inputs::CollectionSelectInput
- CarnivalEnumInput
- Defined in:
- app/inputs/carnival_enum_input.rb
Instance Method Summary collapse
- #constant_name ⇒ Object
- #get_collection ⇒ Object
- #input(wrapper_options = nil) ⇒ Object
- #input_html_classes ⇒ Object
Instance Method Details
#constant_name ⇒ Object
16 17 18 |
# File 'app/inputs/carnival_enum_input.rb', line 16 def constant_name "#{attribute_name.upcase}_ENUM" end |
#get_collection ⇒ Object
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( = nil) [:collection] ||= get_collection super() end |
#input_html_classes ⇒ Object
8 9 10 |
# File 'app/inputs/carnival_enum_input.rb', line 8 def input_html_classes super.push('form-control') end |