Class: Fields::SelectRadioController

Inherits:
MainController
  • Object
show all
Defined in:
app/fields/controllers/select_radio_controller.rb

Instance Method Summary collapse

Methods inherited from MainController

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

Instance Method Details

#optionsObject



5
6
7
8
9
10
11
12
13
14
# File 'app/fields/controllers/select_radio_controller.rb', line 5

def options
  attrs.options.then do |options|
    if options[0].is_a?(Hash)
      options_hash = options
    else
      options_hash = options.collect { |option| {value: option, label: option }}
    end
    options_hash
  end
end