Class: CaringForm::Field::CheckBox
- Inherits:
-
Collection
- Object
- Struct
- Base
- Collection
- CaringForm::Field::CheckBox
- Defined in:
- lib/caring_form/field/check_box.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Collection
Methods inherited from Base
#default_label, #initialize, register, #render, #simple_type
Constructor Details
This class inherits a constructor from CaringForm::Field::Base
Instance Method Details
#apply_to_model(klass) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/caring_form/field/check_box.rb', line 8 def apply_to_model(klass) unless value.present? raise ArgumentError, "check_box: missing mandatory :value parameter" end self.collection = [[value[:label], value[:checked]]] super end |
#input_properties(form, options = {}) ⇒ Object
16 17 18 19 20 |
# File 'lib/caring_form/field/check_box.rb', line 16 def input_properties(form, = {}) super.tap do |req| req[:as] = .fetch(:as, :caring_check) end end |