html - Rails simple-form with multiple instances of the same object -


i trying create rails form using simple form uses nested resources. however, want able submit multiple instances of associated resource. example below explain better.

<div class="tab-pane active" id="reminder">     <%= simple_form_for @collection, html: {multipart: true}, url: collection_index_path |m| %>          <%= render partial: "collection/tabs/reminder", locals: { :m => m } %>     </div> 

-inside partial

<% 9.times |j|%>     <div class="tab-pane" id="<%= j %>">         <%= m.simple_fields_for :reminder |p| %>             <%= p.input :heading %>             <%= p.input :message %>         <% end %>                </div> 

there tabbed pane in user can click through 9 tabs set 9 reminders, should associated collection (collection model accepts nested attributes reminder). however, way have setup now, controller gets set in last reminder in params. anyway ideas appreciated.

there must way distinguish tabs before submitting controller. , think answer might here. i.e. looks this:

<% 9.times |j|%>     <div class="tab-pane" id="<%= j %>">         <%= m.simple_fields_for :reminders |p| %>            <%= p.input :heading %>            <%= p.input :message %>         <% end %>     </div> <% end %> 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

node.js - How to abort query on demand using Neo4j drivers -