carmen-ruby / carmen-rails

NOT ACTIVELY MAINTAINED Rails adapter for Carmen (provides country_select and subregion_select)
MIT License
215 stars 159 forks source link

how to give state short names. #56

Open dinshawraje opened 9 years ago

dinshawraje commented 9 years ago

I have given this in my view:

<div class="input-control select country_input" data-role="input-control">
      <%= f.select :country, region_options_for_select(only_us_and_france),:prompt => 'Select Country' %>
</div>               
<div class="input-control select state_input" data-role="input-control">
          <%= render partial: 'subregion_select', locals: {parent_region: f.object.country} %>
 </div>

and in my subregion partial this:

<div id="account_state_code_wrapper" >
  <% parent_region ||= params[:parent_region] %>
  <% country = Carmen::Country.coded(parent_region) %>

  <% if country.nil? %>
      <div style="display: none">State</div>
  <% elsif country.subregions? %>
      <%= subregion_select(:account_detail, :state_code, parent_region) %>
  <% else %>
      <%= text_field(:account_detail, :state_code) %>
  <% end %>
</div>

So its showing the name of countries and states but I want to show in my select option like Ak and Al so on for state also. Please help me out. Thanks in advance.