Class: StatePickerInput
Overview
SimpleForm input wrapper: state picker.
Instance Method Summary
collapse
#input, #input_html_classes
Instance Method Details
#collection ⇒ Object
8
9
10
11
12
13
14
|
# File 'app/inputs/state_picker_input.rb', line 8
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_isos ⇒ Object
4
5
6
|
# File 'app/inputs/state_picker_input.rb', line 4
def country_isos
options[:country_isos] || %w[US CA]
end
|