0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

backbonejs model conflict with connect-slashes

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
This commit is contained in:
Karl Mikkelsen 2013-12-10 12:57:23 +11:00
parent 56de932492
commit 84bda76c18

View file

@ -41,6 +41,13 @@
return Backbone.oldsync(method, model, options, error); 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 () { Ghost.init = function () {
// remove the temporary message which appears // remove the temporary message which appears
$('.js-msg').remove(); $('.js-msg').remove();