Last active
August 29, 2015 14:04
-
-
Save deanmarano/58d65bbef6c1cc475dc6 to your computer and use it in GitHub Desktop.
Authorized Routes
This file contains 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
AuthRoute = Ember.Route.extend | |
authorize: (-> | |
@transitionTo 'login' unless @modelFor('application') | |
).on('willTransition') | |
## Which is the same as.... | |
AuthRoute = Ember.Route.extend | |
willTransition: -> | |
@transitionTo 'login' unless @modelFor('application') | |
# but the top method allows you to have multiple things happen on willTransition, the second one overrides it for everyone | |
OrganizationsRoute = AuthRoute.extend | |
model: -> | |
# whatever here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment