Skip to content

Commit

Permalink
Only replace last :collection_id when collection: true set
Browse files Browse the repository at this point in the history
  • Loading branch information
1602 committed Feb 13, 2013
1 parent 1ddd479 commit 390a1fd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/railway_routes.js
Expand Up @@ -124,7 +124,7 @@ Map.prototype.root = function (handler, middleware, options) {
options = {};
}

path = options.collection ? path.replace(/\/:.*_id/, '') : path;
path = options.collection ? path.replace(/\/:[^\/\:]+_id(\/[^\:]+)$/, '$1') : path;

var args = [path];
if (middleware) {
Expand Down

0 comments on commit 390a1fd

Please sign in to comment.