Class: ItemPickerInput
- Inherits:
-
TomSelectInput
- Object
- SimpleForm::Inputs::CollectionSelectInput
- TomSelectInput
- ItemPickerInput
- Defined in:
- app/inputs/item_picker_input.rb
Instance Method Summary collapse
Methods inherited from TomSelectInput
Instance Method Details
#collection ⇒ Object
9 10 11 12 |
# File 'app/inputs/item_picker_input.rb', line 9 def collection return [] unless selected_value Item.where(id: selected_value).map { |i| [i.to_s, i.id] } end |
#input(wrapper_options = nil) ⇒ Object
2 3 4 5 6 7 |
# File 'app/inputs/item_picker_input.rb', line 2 def input( = nil) [:data] ||= {} [:data]['tom-select-suggest-url-value'] = template.lookup_items_path([:query_params].presence || {}) [:include_blank] = true unless [:multiple] super() end |