I want to use carmen-rails
gem in my rails project, but in documentation at github i can't understand well how to use it , so i think : if for example i want my users have a country and state :
first : i should add 2 columns in my user model (country and state), Right ?
second : add select country and state to my user form :
<%= simple_form_for @user do |f| %>
<div class="field">
<%= f.label :country_code %><br />
<%= f.country_select :country_code, priority: %w(US CA), prompt: 'Please select a country' %>
</div>
<div class="field">
<%= f.label :state_code %><br />
<%= render partial: 'subregion_select', locals: {parent_region: f.object.country_code} %>
</div>
<% end %>
then my partial should be look like :
<div id="order_state_code_wrapper">
<% parent_region ||= params[:parent_region] %>
<% country = Carmen::Country.coded(parent_region) %>
<% if country.nil? %>
<em>Please select a country above</em>
<% elsif country.subregions? %>
<%= subregion_select(:order, :state_code, parent_region) %>
<% else %>
<%= text_field(:order, :state_code) %>
<% end %>
I'm right ?
then how to validate country and state when the form is submitted ?
finally how to change language of countries and states in the select form (to french for example ) ?