0

Hi I am using gem 'carmen-rails' In my view I have written this

<%= f.country_select :country, prompt: 'Please select a country',
                                   :id=>'curr-country' %>

but its not taking this id 'curr-country'. Please guide how to give id in this. Thanks in advance.

Dinshaw Raje
  • 933
  • 1
  • 12
  • 33

4 Answers4

1

You'll have to pass a second hash with the HTML options:

<%= f.country_select :country, 
                    { prompt: 'Please select a country' },
                    { id: 'curr-country' } %>

The carmen-rails gem doesn't document this explicitly (it is documented in code). The country_select gem, however, does provide an example of this in the Usage section of the README

sczizzo
  • 3,196
  • 20
  • 28
Arup Rakshit
  • 116,827
  • 30
  • 260
  • 317
0
 <%= f.country_select :country, {id: 'curr-country', prompt: 'Please select a country'} %>

try this

Sachin R
  • 11,606
  • 10
  • 35
  • 40
0

Try this

<%= f.country_select :country, {priority: %w(US CA)}, {prompt: 'Please select a country'}, {:id => 'your-id'} %>

Hope this will help you.

Akshay Borade
  • 2,442
  • 12
  • 26
0
<%= f.country_select :country, {},  class: "form-control" %>

Try this one :)