I am trying to make the default value for the country input in a form to be "United States". I am using the simple form gem and country select gem.
In the simple form initializer, I set this default
config.country_priority = [ "United States" ]
Which makes the topmost value correct as United States, but the default value is 'Uganda'.
In the _form view, I did the following:
<%= f.input :country, :default => [ 'United States' ] %>
I restarted Rails and it still defaulted to Uganda.
I also tried the following:
<%= f.input :country, :default => 'United States' %>
and
<%= f.input :country, :selected => 'United States' %>
What should I try next?
Try this,
<%= form.country_select :country, ["United States"] %>
I tried this with gem 'country_select' in simple-form. It's worked for me.
= f.input :country, priority: [ "Brazil" ]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With