Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3.1 Formtastic input custom id or class

I want to make chain selects part inside my Formtastic form. But is it possible to set custom ids for multiple selects for future AJAX replacement?

This doesn't work:

<%= semantic_form_for [:admin, @production_year] do |f| %>
  <%= f.inputs do %>
    <%= f.input :car_model, :label => "CarModel", :as => :select, :collection => Brand.find(:all, :order => "name ASC"), :id => "brand_id" %>
  <% end %>
<% end %>
like image 573
BazZy Avatar asked Oct 15 '11 17:10

BazZy


1 Answers

Options should be passed to the input_html hash, like so:

<%= f.input :car_model, :input_html => { :id => "brand_id" } %>
like image 122
DuoSRX Avatar answered Sep 28 '22 18:09

DuoSRX