Class: Fields::SelectController
Instance Method Summary
collapse
#blur, #errors, #label, #marked, #model, #setup_field
Instance Method Details
#options ⇒ Object
5
6
7
8
9
10
11
12
|
# File 'app/fields/controllers/select_controller.rb', line 5
def options
if attrs.options[0].is_a?(Hash)
options = attrs.options
else
options = attrs.options.collect { |option| { value: option, label: option } }
end
options
end
|
#selected?(value) ⇒ Boolean
14
15
16
|
# File 'app/fields/controllers/select_controller.rb', line 14
def selected?(value)
true if value == model.send(@field_name)
end
|