module ActiveScaffold::Bridges::UsaStateSelect::UsaStateSelectOptionsHelpers
Constants
- USASTATES
Public Instance Methods
Source
# File lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb, line 14 def usa_state_options_for_select(selected = nil, priority_states = nil) state_options = if priority_states options_for_select(priority_states + [['-------------', '']], selected: selected, disabled: '') else options_for_select([]) end state_options += if priority_states&.include?(selected) options_for_select(USASTATES - priority_states, selected: selected) else options_for_select(USASTATES, selected: selected) end state_options end
Returns a string of option tags for the states in the United States. Supply a state name as +selected to have it marked as the selected option tag. Included also is the option to set a couple of priority_states
in case you want to highligh a local area NOTE: Only the option tags are returned from this method, wrap it in a <select>