Class: Fields::RadioController

Inherits:
MainController show all
Defined in:
app/fields/controllers/radio_controller.rb

Instance Method Summary collapse

Methods inherited from MainController

#blur, #errors, #label, #marked, #model, #setup_field

Instance Method Details

#checked?(value) ⇒ Boolean

Returns:

  • (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