Class: SalesRepPickerTomSelectInput
- Inherits:
-
TomSelectInput
- Object
- SimpleForm::Inputs::CollectionSelectInput
- TomSelectInput
- SalesRepPickerTomSelectInput
- Defined in:
- app/inputs/sales_rep_picker_tom_select_input.rb
Overview
Tom Select input for sales rep pickers
Use as: :sales_rep_picker_tom_select
Pass role: :primary, :secondary, or :local to filter by rep type
Instance Method Summary collapse
Methods inherited from TomSelectInput
Instance Method Details
#collection ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/inputs/sales_rep_picker_tom_select_input.rb', line 5 def collection role = [:role] || :sales_rep reps = case role.to_sym when :primary then Employee. when :secondary then Employee. when :local then Employee. else Employee. end if (excluded_ids = [:exclude]) reps = reps.reject { |_name, id| id.in?(excluded_ids) } end [:collection] = reps super end |