a664fda6 by Adam Heath

Add a callout that can convert the cloned model in each-* back into

whatever real model the adapter wants.
1 parent 1b41817b
......@@ -319,6 +319,12 @@ iterate = (collection, callback) ->
else
callback(m, n) for n, m of collection
convertToModel = (data) ->
if Rivets.config.adapter.convertToModel
Rivets.config.adapter.convertToModel(data)
else
data
# Core binding routines.
createInputBinder = (routine) ->
publishes: true
......@@ -402,6 +408,7 @@ Rivets.binders =
iterate @view.models, (item, i) => data[i] = item
data[@args[0]] = item
data["#{@args[0]}_index"] = data['rivets_index'] = i
data = convertToModel data
itemEl = el.cloneNode true
previous = if iterated.length > 0
iterated[iterated.length - 1].els[0]
......