Class: Fields::RadioController
- Inherits:
-
MainController
- Object
- Volt::ModelController
- MainController
- Fields::RadioController
- Defined in:
- app/fields/controllers/radio_controller.rb
Instance Method Summary collapse
- #checked?(value) ⇒ Boolean
-
#set_field(value) ⇒ Object
When a radio button is clicked, set the value of the field and start checking the field.
Methods inherited from MainController
#blur, #errors, #label, #marked, #model, #setup_field
Instance Method Details
#checked?(value) ⇒ Boolean
11 12 13 |
# File 'app/fields/controllers/radio_controller.rb', line 11 def checked?(value) value == model.send(@field_name) end |
#set_field(value) ⇒ Object
When a radio button is clicked, set the value of the field and start checking the field
6 7 8 9 |
# File 'app/fields/controllers/radio_controller.rb', line 6 def set_field(value) model.send("#{@field_name}=", value) model.mark_field!(@field_name) end |