oops, have it use the view instead of the model

This commit is contained in:
John Bintz 2011-04-15 16:11:57 -04:00
parent db584858cf
commit 1b91906250
2 changed files with 2 additions and 1 deletions

View File

@ -46,6 +46,7 @@ describe 'backbone-generator' do
File.file?(template = 'app/views/section/models.jst').should be_true File.file?(template = 'app/views/section/models.jst').should be_true
File.read(view).should match(/SectionModelsView/) File.read(view).should match(/SectionModelsView/)
File.read(view).should match(/SectionModelView/)
File.read(view).should match(%r{template: JST\['section/models'\]}) File.read(view).should match(%r{template: JST\['section/models'\]})
File.read(spec).should match(/SectionModelsView/) File.read(spec).should match(/SectionModelsView/)
end end

View File

@ -13,7 +13,7 @@ var <%= object_name %>sView = Backbone.View.extend({
$(this.el).html(this.template()); $(this.el).html(this.template());
}, },
addOne: function(model) { addOne: function(model) {
var view = new <%= object_name %>({model: model}); var view = new <%= object_name %>View({model: model});
this.$('.list').append(view.render().el); this.$('.list').append(view.render().el);
}, },
addAll: function() { addAll: function() {