I want to create multiple instances of the same object in one form. I have tried
<%= form_tag(animals_path) do %>
<% @animals.each do |animal| %>
<%= fields_for "animals[]",animal do |f| %>
`//animal fields
<% end %>
<%= submit_tag 'save' %>`
but got error: "undefined method `merge!' for nil:NilClass"
I have built @animals at my controller.
using rails 3.0.7
any help is appreciated.
Aucun commentaire:
Enregistrer un commentaire