Closed petergoldstein closed 11 years ago
Awesome! Thanks a lot.
Great!, working fine country selection in rails 4, but state selection not working.
I can't get the states to appear as a drop down in rails4. Anyone had any luck with this?
Rob, you have a country set first right?
Yeah! Did you get it to work?
<%= form.label :country %>
<%= form.country_select :country, {priority: %w(US CA), prompt: 'Please select a country'} %>
<%= form.label :state %>
<%= render partial: '/users/subregion_select', locals: {parent_region: form.object.country} %>
here's my partial----
<div id="order_state_code_wrapper">
<% parent_region ||= params[:parent_region] %>
<% unless parent_region.nil? %>
<% country = Carmen::Country.coded(parent_region) %>
<% end %>
<% if country.nil? %>
<em>Please select a country above</em>
<% elsif country.subregions? %>
<%= subregion_select(:order, :state, parent_region) %>
<% else %>
<%= text_field(:order, :state) %>
<% end %>
</div>
At the time of rendering, the States pulldown doesn't have a state to work from, so you need to do some javascript magic to update the pulldown after choosing a state. I don't have time to search this right now but I think you can find this javascript blurb in the Carmen example app here on Github.
In this PR:
1) Made the Gemfile configurable in terms of Rails version 2) Updated the Travis CI matrix to include Ruby 2.0 and Rails versions 3.1.x, 3.2.x, and 4.0.x 3) Moved the tests to the standard file location for Minitest tests 4) Updated the helper code to work with Rails 4 when generating select/option tags 5) Updated the test to accommodate changes in tag output between Rails 3 and Rails 4
Travis CI passes for all elements of the matrix