Dynamic input form in rails -


i trying add rows of input forms partial. of fields in partial have collection_select:

<td><%= label_tag :book_id, t("book") %></td> <td><%= collection_select :books, "books[:id]", book.all, :id, :name %></td> 

the problem when dynamically add rows of kind last 1 passed controller in params. did not pass collection partial because dynamically added. appreciate if can me out one.

its because param name being replaced clones. can add counter:

<% (1..10).each |i| %>   <td><%= collection_select :books, "books[#{i}][:id]", book.all, :id, :name %></td> <% end %> 

of course, simple example. better control counter javascript events.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

Error while updating a record in APEX screen -

c++ - In an add-in in Excel, written in C(++), how does one get the name of the function which called into the addin? -