Nested form and AngularJS, duplicated entities

Hello!
In my app i have a model Adventure, which has many Quests (and has
“accepts_nested_attributes_for :quests, :allow_destroy => true” ). My
form
for adventure looks like this:

  <ul>
   Minimal player level<br />
Name:<br />


<%= f.submit 'Save', :class => 'submit-btn' %>

<% end %>

And the _quest_feilds.html.erb file

<%= hidden_field_tag

‘adventure[quests_attributes][{{quest_index}}][order]’, :value =>
‘{{$index}}’ %>


Title:

<%= text_field_tag
‘adventure[quests_attributes][{{quest_index}}][title]’,

‘{{quest.title}}’, :size => 150, id: ‘quest_{{$index}}_title’ %>


Description

<%= text_area_tag

‘adventure[quests_attributes][{{quest_index}}][description]’,’{{quest.description}}’,

:cols => 107, :rows => 10, id:

‘quest_{{$index}}_description’ %>

And the problem is, when i’m trying to update any Adventure, instead of
updating the quests, it keeps old records and is simply adding modified
ones. So, instead of two records, when i’ll modify the adventure, i have
four records. Does anybody have an idea ?

Thanks in advance!