jim/carmen-rails — pull request #19 by tinynumbers (2013-02-07 21:51:41+00:00)
Title: Modified country_select to permit passing :object as an option.

I'm faced with the following scenario:

* Using Formtastic to generate forms
* Using a nested form:
* form is created for an Order model object
* sub-form is created for an Address model object
* using `form.input :as => :country` as the form-field for the Address country

The Address object was not being passed through the whole field generation stack so therefore the previously-set value for the Address country was not being pre-selected in the country_select.

To fix this, I've added the ability for `country_select` to pull the `object` from the `args` in the same way that `subregion_select` does. That way I can pass the object manually from my sub-form, e.g.:

= subform.input :country_code, :as => :country,
:priority_countries => %w[US CA],
:object => subform.object