Skip to content

Instantly share code, notes, and snippets.

@rinatio
rinatio / gist:3873386
Created October 11, 2012 15:59 — forked from mattheworiordan/gist:1037984
Backbone patch to defer update method requests when new create requests are not complete on a model
(function() {
Backbone.Model.prototype._save = Backbone.Model.prototype.save;
Backbone.Model.prototype.save = function (attrs, options) {
var that = this;
if (!options) {
options = {};
}
if (this.savingNewRecord) {
// store or replace last PUT request with the latest version, we can safely replace old PUT requests with new ones
// but if there are callbacks from a previous PUT request, we need to make sure they are all called as well
@rinatio
rinatio / gist:3757866
Created September 20, 2012 19:30
ActiveRecord
<?php
class ActiveRecord extends CActiveRecord
{
public static function model($className = null)
{
return parent::model($className ? : get_called_class());
}