backbone-nested-attributes 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,16 +51,21 @@
51
51
  return attributes
52
52
  }
53
53
 
54
- function configureNestedAttributesEvents(model) {
55
- if (!model._hasNestedAttributesEventsConfigured) {
56
- model.on('sync', function () {
57
- _(model.relations).each(function (relation) {
58
- var collection = model.get(relation.key)
54
+ function clearDeletedModelsFor(model) {
55
+ _(model.relations).each(function (relation) {
56
+ var collection = model.get(relation.key)
59
57
 
60
- collection.deletedModels.reset()
61
- })
58
+ collection.each(function (nestedModel) {
59
+ clearDeletedModelsFor(nestedModel)
62
60
  })
63
61
 
62
+ collection.deletedModels.reset()
63
+ })
64
+ }
65
+
66
+ function configureNestedAttributesEvents(model) {
67
+ if (!model._hasNestedAttributesEventsConfigured) {
68
+ model.on('sync', clearDeletedModelsFor)
64
69
  model._hasNestedAttributesEventsConfigured = true
65
70
  }
66
71
  }
@@ -1,5 +1,5 @@
1
1
  module Backbone
2
2
  module NestedAttributes
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backbone-nested-attributes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -99,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
99
  version: '0'
100
100
  segments:
101
101
  - 0
102
- hash: -971025250535870783
102
+ hash: -2817376123414823357
103
103
  required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  none: false
105
105
  requirements:
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  segments:
110
110
  - 0
111
- hash: -971025250535870783
111
+ hash: -2817376123414823357
112
112
  requirements: []
113
113
  rubyforge_project:
114
114
  rubygems_version: 1.8.24