Class: Fields::RadioController

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

Instance Method Summary collapse

Methods inherited from SelectRadioController

#options

Methods inherited from MainController

#blur, #errors, #field_name, #label, #marked, #model_inst, #setup_field

Instance Method Details

#nameObject



6
7
8
# File 'app/fields/controllers/radio_controller.rb', line 6

def name
  attrs.name || "#{field_name}_radio"
end

#selected?(option) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'app/fields/controllers/radio_controller.rb', line 10

def selected?(option)
  option[:value] == model_inst.send(@field_name) ? true : false
end

#set(option) ⇒ Object



14
15
16
# File 'app/fields/controllers/radio_controller.rb', line 14

def set(option)
  model_inst.send("#{@field_name}=", option[:value])
end