088a0570 by Michael Richards

Implement object specificity for dependent attribute declarations. [Closes #53]

1 parent 1e6b3edf
......@@ -80,8 +80,16 @@ class Rivets.Binding
@sync() if Rivets.config.preloadData
if @options.dependencies?.length
for keypath in @options.dependencies
Rivets.config.adapter.subscribe @model, keypath, @sync
for dependency in @options.dependencies
if /^\./.test dependency
model = @model
keypath = dependency.substr 1
else
dependency = dependency.split '.'
model = @view.models[dependency.shift()]
keypath = dependency.join '.'
Rivets.config.adapter.subscribe model, keypath, @sync
if @isBidirectional()
bindEvent @el, 'change', @publish
......