edc9c231 by Michael Richards

Update the model setters to use @view.models is the @key is null (top-level keypath). [Closes #172]

1 parent 3f439a7a
...@@ -36,7 +36,7 @@ class Rivets.Binding ...@@ -36,7 +36,7 @@ class Rivets.Binding
36 @binder or= @view.binders['*'] 36 @binder or= @view.binders['*']
37 @binder = {routine: @binder} if @binder instanceof Function 37 @binder = {routine: @binder} if @binder instanceof Function
38 @formatters = @options.formatters || [] 38 @formatters = @options.formatters || []
39 @model = @view.models[@key] 39 @model = if @key then @view.models[@key] else @view.models
40 40
41 # Applies all the current formatters to the supplied value and returns the 41 # Applies all the current formatters to the supplied value and returns the
42 # formatted value. 42 # formatted value.
...@@ -139,7 +139,7 @@ class Rivets.Binding ...@@ -139,7 +139,7 @@ class Rivets.Binding
139 # the old model first and then re-binds with the new model. 139 # the old model first and then re-binds with the new model.
140 update: => 140 update: =>
141 @unbind() 141 @unbind()
142 @model = @view.models[@key] 142 @model = if @key then @view.models[@key] else @view.models
143 @bind() 143 @bind()
144 144
145 # Rivets.View 145 # Rivets.View
......