mahalo/etch — Issue #1: Etch does not dispatch a save event on the model
Author: jackcviers
Created: 2011-12-23 00:14:23+00:00
State: open

As in your tutorial, I set up a View with an attached model.

```
(function(){
window.MyBackboneModel = Backbone.Model.extend({
initialize:function(options){
var attr = {
content:""
}
, initialAttributes = _.defaults(attr, options);
_.each(_.keys(initialAttributes), function(key){this.set({key:initalAttributes[key]});});
this.save();
}
, urlRoot : "/contentArea"
});
window.ContentAreaView = Backbone.View.extend({
initialize:function(options){
var attr = {
modelClass:window.MyBackboneModel
}
, initialAttributes = _.defaults(attr, options);
_.each(_.keys(initialAttributes), function(key){this[key] = initalAttributes[key]);});
if(!this.model){
this.model = new modelClass();
}
this.model.bind('save', _.bind(function(){this.model.save();}, this));
}
, events: {
"click .editable":editableInit
}
, editableInit:function(e){e.srcElement:this.el; etch.editableInit(e);}
});
$(function(){
$($('document body div')[0]).html( '

My Title

Some Text!

');
var editable = $('article#myNewEditable').get();
var view = new ContentAreaView({el:editable});
});
}());
```

When clicked upon, the editableInit works, but when save is clicked, the model is not saved. From looking through the source code, it appears that the model from the clicked view is never fetched by etch. Therefore, listening to ```this.model``` for save events won't trigger a save action through the listener.