Routing Scope and Through parameters to routes.#35
Merged
Conversation
Issue: (Routing Scopes [ch40] )[https://app.clubhouse.io/amber/story/40/route-scopes] Scopes are a way to group routes under a common path prefix and scoped set of plug middleware. We might want to do this for admin functionality, APIs, and especially for versioned APIs. Let's say we have user generated reviews on a site, and that those reviews first need to be approved by an admin. The semantics of these resources are quite different, and they might not share the same controller. Scopes enable us to segregate these routes. Overloaded the router.draw method to receive a valve and through attributes. This allows to define scopes for routes and allows for cleaner definition of routes.
elorest
approved these changes
May 4, 2017
Member
elorest
left a comment
There was a problem hiding this comment.
Looks good. Sorry it took so long.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Routing Scope and Through parameters to routes.
Issue: Routing Scopes [ch40]
Requirements
Scopes are a way to group routes under a common path prefix and scoped
set of plug middleware. We might want to do this for admin
functionality, APIs, and especially for versioned APIs. Let's say we
have user generated reviews on a site, and that those reviews first need
to be approved by an admin. The semantics of these resources are quite
different, and they might not share the same controller. Scopes enable
us to segregate these routes.
Description of the Change
Overloaded the router.draw method to receive a valve and through
attributes. With these 2 attributes routes can now be defined as follow.
Why Should This Be In Core?
Benefits
get "/hello", HelloController, :index, :web