Skip to content

Instantly share code, notes, and snippets.

@deanmarano
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deanmarano/58d65bbef6c1cc475dc6 to your computer and use it in GitHub Desktop.
Save deanmarano/58d65bbef6c1cc475dc6 to your computer and use it in GitHub Desktop.
Authorized Routes
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