express-resource icon indicating copy to clipboard operation
express-resource copied to clipboard

similarly named nested resources not provided for

Open jupiter opened this issue 14 years ago • 5 comments

This works:

    var photos = app.resource('photos', photosController)
      , posts = app.resource('posts', postsController)
      , photosComments = app.resource('comments', commentsController)
      , postsComments = app.resource('comments', commentsController);

    photos.add(photosComments);
    posts.add(postsComments);

However, I am not sure whether this will create problems down the line. Particularly because app.resources.comments will always be the last nested resource added, and the first one would not be accessible via app.resources.

jupiter avatar Sep 15 '11 14:09 jupiter

Same issue here

dmmalam avatar Nov 08 '11 13:11 dmmalam

+1, just got to this point in my app

piotrek-r avatar Mar 11 '12 10:03 piotrek-r

I have two nested resources with the same name, but different controllers, and have been experiencing issue. I'm using the Resource class directly as a work-around for now, and it seems to work well....

 var photos = app.resource('photos', photosController)
      , posts = app.resource('posts', postsController)
      , photosComments = new Resource('comments', photoCommentsController, app)
      , postsComments = new Resource('comments', postCommentsController, app);

photos.add(photosComments);
posts.add(postsComments);

suprememoocow avatar Mar 06 '13 14:03 suprememoocow

+1

vjpr avatar Jun 07 '13 10:06 vjpr

Using the workaround when re-using a root level resource results in the load method for collections/links being run for /links.

/links
/collections/:id/links

vjpr avatar Jun 07 '13 12:06 vjpr