Class: SupplierPickerInput

Inherits:
TomSelectInput
  • Object
show all
Defined in:
app/inputs/supplier_picker_input.rb

Instance Method Summary collapse

Methods inherited from TomSelectInput

#input_html_classes

Instance Method Details

#collectionObject



8
9
10
# File 'app/inputs/supplier_picker_input.rb', line 8

def collection
  Supplier.where(id: selected_value.to_i).map { |r| [r.to_s, r.id] }
end

#input(wrapper_options = nil) ⇒ Object



2
3
4
5
6
# File 'app/inputs/supplier_picker_input.rb', line 2

def input(wrapper_options = nil)
  input_html_options[:data] ||= {}
  input_html_options[:data]['tom-select-suggest-url-value'] = template.lookup_parties_by_category_path(search_for: 'supplier')
  super(wrapper_options)
end