Class: SimpleFormWithClientValidation::Inputs::CollectionInput
- Defined in:
- lib/simple_form_with_client_validation/inputs/collection_input.rb
Direct Known Subclasses
CollectionRadioButtonsInput, CollectionSelectInput, GroupedCollectionSelectInput
Instance Attribute Summary
Attributes inherited from Base
#attribute_name, #column, #html_classes, #input_html_classes, #input_html_options, #input_type, #options, #reflection
Class Method Summary collapse
-
.boolean_collection ⇒ Object
Default boolean collection for use with selects/radios when no collection is given.
Instance Method Summary collapse
Methods inherited from Base
Methods included from SimpleFormWithClientValidation::I18nCache
#get_i18n_cache, #i18n_cache, #reset_i18n_cache
Methods included from Components::Readonly
Methods included from Components::Placeholders
#placeholder, #placeholder_text
Methods included from Components::Pattern
Methods included from Components::MinMax
Methods included from Components::Minlength
Methods included from Components::Maxlength
Methods included from Components::LabelInput
Methods included from Components::HTML5
Methods included from Components::Hints
Methods included from Components::Errors
Methods included from Helpers::Validators
Constructor Details
This class inherits a constructor from SimpleFormWithClientValidation::Inputs::Base
Class Method Details
.boolean_collection ⇒ Object
Default boolean collection for use with selects/radios when no collection is given. Always fallback to this boolean collection. Texts can be translated using i18n in “simple_form.yes” and “simple_form.no” keys. See the example locale file.
8 9 10 11 12 13 |
# File 'lib/simple_form_with_client_validation/inputs/collection_input.rb', line 8 def self.boolean_collection i18n_cache :boolean_collection do [ [I18n.t(:"simple_form.yes", :default => 'Yes'), true], [I18n.t(:"simple_form.no", :default => 'No'), false] ] end end |
Instance Method Details
#input ⇒ Object
15 16 17 18 |
# File 'lib/simple_form_with_client_validation/inputs/collection_input.rb', line 15 def input raise NotImplementedError, "input should be implemented by classes inheriting from CollectionInput" end |
#input_options ⇒ Object
20 21 22 23 24 |
# File 'lib/simple_form_with_client_validation/inputs/collection_input.rb', line 20 def = super [:include_blank] = true unless skip_include_blank? end |