Add country field option to country_select ruby ​​on rails gem

I am currently using country_select stone for rubies on rails: https://github.com/stefanpenner/country_select

The following code prints a list of all countries:

<%= f.country_select :CountryTo, html_options = {:class => "form-control"} %>

      

I want to add a custom parameter field in the select dropdown with the value "Anywhere". Does anyone know how I can achieve this? I am new to Ruby on rails, so apologize if there is a very light fix, thanks.

+3
ruby ruby-on-rails drop-down-menu ruby-on-rails-3 ruby-on-rails-4


source to share


1 answer


As per tests,country_select

it supports include_blank

-description select_tag

. Therefore, you should be able to use:

<%= f.country_select(:country_to, include_blank: 'Anywhere') %>

      



Please also note the ruby style .

+1


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics