Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

'marked_for_destruction' not appended to 'fields' class when using wrapper: false #357

Open
tbrammar opened this issue Jul 23, 2015 · 0 comments

Comments

@tbrammar
Copy link

Hi,

I have the following code:

<table id="js_user_permissions" >
  <%= nested_form_for(user) do |f| %>
    ....
    <%= f.fields_for :permissions, wrapper: false do |p| %>
      <tr class="fields">
        <td>
          <%= p.select :country_id, countries.collect {|c| [ c.name, c.id ] } %>
        </td>
        <td>
          <%= p.link_to_remove "Remove" %>
          <p></p>
        </td>
      </tr>
    <% end %>
    <%= f.link_to_add "Add permissions", :permissions, data: { target: "#js_user_permissions" } %>
  <% end %>
</table>

Everything works as expected: I can add new permissions to new records / existing records, I can remove permissions from existing records etc.

However, with validations I can't seem to get the marked_for_destruction class added to my <tr class="fields"> tag.

If I remove a permission from an existing record, submit the form and then it fails validation the re-rendered form doesn't display the marked_for_destruction class on that DOM.

Any ideas?

@tbrammar tbrammar changed the title marked_for_destruction not appended to fields class when using wrapper: false 'marked_for_destruction' not appended to 'fields' class when using 'wrapper: false' Jul 23, 2015
@tbrammar tbrammar changed the title 'marked_for_destruction' not appended to 'fields' class when using 'wrapper: false' 'marked_for_destruction' not appended to 'fields' class when using wrapper: false Jul 23, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant