Skip to content

Commit

Permalink
backbonejs model conflict with connect-slashes
Browse files Browse the repository at this point in the history
close #1648
- backbonejs model doesn't include tailing slash by default
- connect-slashes returns 301 for GET without tailing slash
- overwrote backbone model url method to include tailing slash
  • Loading branch information
karlmikko committed Dec 11, 2013
1 parent 119af63 commit 12c307f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/client/init.js
Expand Up @@ -41,6 +41,13 @@
return Backbone.oldsync(method, model, options, error);
};

Backbone.oldModelProtoUrl = Backbone.Model.prototype.url;
//overwrite original url method to add slash to end of the url if needed.
Backbone.Model.prototype.url = function () {
var url = Backbone.oldModelProtoUrl.apply(this, arguments);
return url + (url.charAt(url.length - 1) === '/' ? '' : '/');
};

Ghost.init = function () {
// remove the temporary message which appears
$('.js-msg').remove();
Expand Down

0 comments on commit 12c307f

Please sign in to comment.