088a0570 by Michael Richards

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

1 parent 1e6b3edf
...@@ -80,8 +80,16 @@ class Rivets.Binding ...@@ -80,8 +80,16 @@ class Rivets.Binding
80 @sync() if Rivets.config.preloadData 80 @sync() if Rivets.config.preloadData
81 81
82 if @options.dependencies?.length 82 if @options.dependencies?.length
83 for keypath in @options.dependencies 83 for dependency in @options.dependencies
84 Rivets.config.adapter.subscribe @model, keypath, @sync 84 if /^\./.test dependency
85 model = @model
86 keypath = dependency.substr 1
87 else
88 dependency = dependency.split '.'
89 model = @view.models[dependency.shift()]
90 keypath = dependency.join '.'
91
92 Rivets.config.adapter.subscribe model, keypath, @sync
85 93
86 if @isBidirectional() 94 if @isBidirectional()
87 bindEvent @el, 'change', @publish 95 bindEvent @el, 'change', @publish
......