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

subregion_select helper doesnt allow to give classes #49

Open indranil-m opened 10 years ago

indranil-m commented 10 years ago

We couldn't pass class names in subregion_select helper;

tried below samples:

subregion_select(:shipping_address, :state_id, parent_region, :html_options => {:class => 'form-control'}) AND subregion_select(:billing_address, :state_id, parent_region, class: 'form-control')

panagioti commented 9 years ago

I spent about three hours trying a whole slew of things here. I expected that the documented approach would work, namely:

<%= subregion_select( @MODEL_NAME, :NAME_OF_ATTRIBUTE_IN_MODEL, parent_region, :class => 'form-control' ) %>

Yet, this did not work very well.

Eventually, I found one approach that worked where two hashes are included in the call to subregion_select (one empty, the other specifying the bootstrap class for the dropdown styling).

<%= subregion_select( @MODEL_NAME, :NAME_OF_ATTRIBUTE_IN_MODEL, parent_region, {}, { :class => 'form-control' } ) %>