Method: MuckEngine::FormBuilder#us_state_select
- Defined in:
- lib/muck-engine/form_builder.rb
#us_state_select(method, options = {}, html_options = {}, additional_state = nil) ⇒ Object
Call ‘<%= country_scripts %>’ to render javascript that will change the state control based on the current country creates a select control with us states. Default id is ‘us_states’. If ‘retain’ is passed for the class value the value of this control will be written into a cookie with the key ‘us_states’.
141 142 143 144 145 |
# File 'lib/muck-engine/form_builder.rb', line 141 def us_state_select(method, = {}, = {}, additional_state = nil) @@country_id ||= Country.find_by_abbreviation('US') @states = (additional_state ? [additional_state] : []) + State.find(:all, :conditions => ["country_id = ?", @@country_id], :order => "name asc") self.(method, I18n.t('muck.engine.choose_state'), @states, .merge(:prompt => I18n.t('muck.engine.select_state_prompt'), :wrapper_id => 'us-states-container'), .merge(:id => 'us-states')) end |