Created
April 20, 2012 20:14
-
-
Save zmcartor/2431522 to your computer and use it in GitHub Desktop.
Backbone View Attributes to Model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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