Permalink
Browse files

Singleton resources can now have nested resources.

  • Loading branch information...
1 parent 832f869 commit c8353c21b24fab44272e560b8da1109483eb7079 @olalonde committed Oct 4, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/railway_routes.js
View
@@ -228,7 +228,11 @@ Map.prototype.resources = function (name, params, actions) {
var activeRoutes = getActiveRoutes(params);
// but first, create subroutes
if (typeof actions == 'function') {
- this.subroutes(name + '/:' + (singularize(name) || name) + '_id', actions);
+ // if Resource is a singleton, we don't need to append /:resource_id
+ if(params.singleton_for)
+ this.subroutes(name + '/', actions);
+ else
+ this.subroutes(name + '/:' + (singularize(name) || name) + '_id', actions);
}
// now let's walk through action routes
for (var action in activeRoutes) {

0 comments on commit c8353c2

Please sign in to comment.