html - Rails: Rendering a partial to the right div? -


In my view I have a loop that renders several partial forms: each partial saving / non-operation operation One easy toggle is a record. Toggles the Boolean field using each partial Javascript, then updates itself, and completes the controller by saying:

  $ controller render: partial = & gt; "Save_unsave_buttons" ,: local => {: Match = & gt; @mailing} ,: layout = & gt; False #view & lt; Div id = & lt;% = "# save {match.id}" -%> & Gt; & Lt;% = Render: Partial = & gt; "Save_unsave_buttons" ,: local => {: Match = & gt; Match}%> & gt; & Lt; / Div & gt;  

When the controller presents partial save_unsave_buttons, it does not renders the right div; This partially updates which gets the first record. How can I ask to save controller save_unsave_buttons with partial div to correct ID?

Thank you!

Looking at only the small information provided for your problem, I think the code is the culprit The div tag

div should be partly within the tag.

Edit : What does your code do with a single div id with save (first match.id) And partially present within it. If I understand you correctly, then you need div for each match . For this, div should be partially.

Then pass archive to . Your view should be:

  #view & lt;% = Render: partial = & gt; "Save_unsave_buttons" ,: local => {: Match = & gt; Match, collection = & gt; {@match_id = & gt; Match.id}}%>  

and in your partial _sav_unsave_buttons.html.erb :

  <% content_tag: div, id = & gt; ; "#% {@ Match_id}" to%> # Your code goes here! & Lt;% end -% & gt;  

Comments