Skip to content

Instantly share code, notes, and snippets.

@zmcartor
Created April 20, 2012 20:14
Show Gist options
  • Save zmcartor/2431522 to your computer and use it in GitHub Desktop.
Save zmcartor/2431522 to your computer and use it in GitHub Desktop.
Backbone View Attributes to Model
BBView = Backbone.View.extend({
el: '#some-selector',
attributes: function () {
return {
name: this.nameField.val(),
email: this.emailField.val(),
password: this.passwordField.val(),
password_confirmation: this.passwordConfirmationField.val()
};
},
...later on
some_model = new SomeModel(this.attributes());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment