Class: StatePickerInput

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

Instance Method Summary collapse

Methods inherited from TomSelectInput

#input, #input_html_classes

Instance Method Details

#collectionObject



6
7
8
9
10
11
12
# File 'app/inputs/state_picker_input.rb', line 6

def collection
  states_select = []
  country_isos.each do |iso|
    states_select += ISO3166::Country[iso].subdivisions.map { |k, v| [v.name || k, k] }
  end
  states_select.sort_by(&:first)
end

#country_isosObject



2
3
4
# File 'app/inputs/state_picker_input.rb', line 2

def country_isos
  options[:country_isos] || %w[US CA]
end