我使用Rails 3.0,Ruby 1.9.2和Plataformatec simple_form gem。此代碼適用於form_for,但不適用於simple_form_for:Ruby on Rails simple_form_for all.each do
<%= simple_form_for(@provider) do |f| %>
<% Car.all.each do |c| %>
<div>
<%= check_box_tag :car_ids, c.id, @store.cars.include?(c), :name => 'store[car_ids][]' %>
$<%= c.cost %> | <%= c.description %>
</div>
<% end %>
<div class="actions">
<%= f.submit "New" %>
</div>
<% end %>
如何使其與simple_form_for配合使用?
在此先感謝!
你是什麼意思'不工作'?顯示發生了什麼。顯示錯誤。顯示我們可以討論的內容 – fl00r
爲什麼您的模型名稱是複數?我的意思是'汽車' – fl00r
對不起,模型不應該是複數,不好的複製。 – sizzle