cf479589 by Isao Jonas

closes issue #100. make the dependency logic in Binding.unbind the same as Binding.bind

1 parent 6905577b
...@@ -112,8 +112,16 @@ class Rivets.Binding ...@@ -112,8 +112,16 @@ class Rivets.Binding
112 Rivets.config.adapter.unsubscribe @model, @keypath, @sync 112 Rivets.config.adapter.unsubscribe @model, @keypath, @sync
113 113
114 if @options.dependencies?.length 114 if @options.dependencies?.length
115 for keypath in @options.dependencies 115 for dependency in @options.dependencies
116 Rivets.config.adapter.unsubscribe @model, keypath, @sync 116 if /^\./.test dependency
117 model = @model
118 keypath = dependency.substr 1
119 else
120 dependency = dependency.split '.'
121 model = @view.models[dependency.shift()]
122 keypath = dependency.join '.'
123
124 Rivets.config.adapter.unsubscribe model, keypath, @sync
117 125
118 # A collection of bindings built from a set of parent elements. 126 # A collection of bindings built from a set of parent elements.
119 class Rivets.View 127 class Rivets.View
......