diff --git a/lib/javascripts/routes.js b/lib/javascripts/routes.js index adc730d..5df21ec 100644 --- a/lib/javascripts/routes.js +++ b/lib/javascripts/routes.js @@ -196,7 +196,7 @@ protocol: window.location.protocol+'//', host: window.location.hostname }; - + Routes.extractNamed = function(){ var route; for (var i = 0; i < this.length; i++) { @@ -204,20 +204,20 @@ if (route.name) { this.named.push(route); this.named[route.name] = route; - - this[route.name] = (function(route){ + + this[route.name + '_path'] = (function(route){ var fn = function(){ var params = {}, options = {}, count; - + //Add defaults from route for (var p in route.params) { if (route.params.hasOwnProperty(p) && route.params[p].constructor !== RegExp) { params[p] = route.params[p]; } } - + //Allows Routes.name('foo', 'bar', {opts}) or Routes.name({foo:'foo', bar:'bar'}, {opts}) if (typeof arguments[0] === 'object' && !(arguments[0] instanceof Array)) { extend(params, arguments[0]); @@ -226,7 +226,7 @@ if (typeof arguments[arguments.length-1] === 'object') { options = arguments[arguments.length-1]; } - + var count = 0; for (var i=0; i < route.segments.length; i++) { if (route.segments[i].isDynamic()) { @@ -235,7 +235,7 @@ } } } - + return route.generate(params, options); };