Pass options.parentResources to route handler #19

Open
wants to merge 2 commits into
from

Conversation

Projects
None yet
3 participants
Contributor

olalonde commented Jun 4, 2013

This could probably use some refactoring like replacing this.latestResource completely by this.latestResources which keeps a stack of parent resources instead of only the immediate parent resource. This is useful if you want to have that information for your route handler. In my case, I want my route handler to execute some authorization middlewares depending on how a controller is called. If 'orders' is nested under the resource 'users', I want to run a middleware that loads the user information. However, if the resource is not nested, I don't need that middleware, etc. So in other words, the way resources are stacked is kind of important to me and probably will be useful to others too so I hope you can merge 👍

Contributor

olalonde commented Jun 4, 2013

Oops, there is a bug in my code. Fixing it.

Contributor

olalonde commented Jun 4, 2013

Ok I think that should fix it.

Contributor

olalonde commented Jun 5, 2013

Do you want me to write tests?

Collaborator

anatoliychakkaev commented Jun 7, 2013

Yep

On Wed, Jun 5, 2013 at 1:46 PM, Olivier Lalonde notifications@github.comwrote:

Do you want me to write tests?


Reply to this email directly or view it on GitHubhttps://github.com/1602/railway-routes/pull/19#issuecomment-18965597
.

vjpr commented Jun 9, 2013

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment