adding a bit more explanation to Model#save onError

This commit is contained in:
Jeremy Ashkenas
2010-12-20 12:31:58 -05:00
parent 4d6d494f2e
commit e3aa5751ac

View File

@@ -708,10 +708,7 @@ setInterval(function() {
method, and validation fails, the model will not be saved. If the model
<a href="#Model-isNew">isNew</a>, the save will be a <tt>"create"</tt>
(HTTP <tt>POST</tt>), if the model already
exists on the server, the save will be an <tt>"update"</tt> (HTTP <tt>PUT</tt>). Accepts
<tt>success</tt> and <tt>error</tt> callbacks in the options hash, which
are passed <tt>(model, response)</tt> as arguments. The <tt>error</tt> callback will
also be invoked if the model has a <tt>validate</tt> method, and validation fails.
exists on the server, the save will be an <tt>"update"</tt> (HTTP <tt>PUT</tt>).
</p>
<p>
@@ -732,6 +729,15 @@ var book = new Backbone.Model({
book.save();
</pre>
<p>
<b>save</b> accepts <tt>success</tt> and <tt>error</tt> callbacks in the
options hash, which are passed <tt>(model, response)</tt> as arguments.
The <tt>error</tt> callback will also be invoked if the model has a
<tt>validate</tt> method, and validation fails. If a server-side
validation fails, return a non-<tt>200</tt> HTTP response code, along with
an error response in text or JSON.
</p>
<p id="Model-destroy">
<b class="header">destroy</b><code>model.destroy([options])</code>
<br />