Reputation: 53
how can we define id for this rails select statement , i have tried doing in this way like
<%= f.select :state, options_for_select(Contact::STATES), :id=>"state_job" %>
but it is not showing any id when i inspect it in the browser. Please help me out
<%= f.select :state, options_for_select(Contact::STATES) %>
Upvotes: 5
Views: 2583
Reputation: 14038
The select tag helper looks for options
, then html_options
, you just need to make sure your id is in the right place (html_options
) by passing something to the options
parameter:
<%= f.select :state, options_for_select(Contact::STATES), {}, {:id=>"state_job"} %>
Upvotes: 11