Skip to content

Instantly share code, notes, and snippets.

@mattboldt
Last active August 29, 2015 14:02
Show Gist options
  • Save mattboldt/fb32da812ef28f6a5a6f to your computer and use it in GitHub Desktop.
Save mattboldt/fb32da812ef28f6a5a6f to your computer and use it in GitHub Desktop.
App.Router.reopen
location: 'history'
rootURL: '/u/'
App.Router.map ->
@resource('documents', path: '/')
@resource('document', path: '/:document_slug/:document_id')
App.DocumentRoute = Ember.Route.extend
# allows us to use slug as the url
serialize: (model, params) ->
{
document_id: model.get('id'),
document_slug: model.get('slug')
}
model: (params) ->
@store.find('document', params.document_id).then (model) ->
model.reload()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment