Skip to content

Instantly share code, notes, and snippets.

@kenelliott
Created February 13, 2014 16:02
Show Gist options
  • Select an option

  • Save kenelliott/8977848 to your computer and use it in GitHub Desktop.

Select an option

Save kenelliott/8977848 to your computer and use it in GitHub Desktop.
beforeModel: (transition) ->
# Attempt #1
# @store.unloadAll(transition.targetName.split('.').shift().singularize().camelize())
# # console.log transition.targetName.split('.').shift().singularize().camelize().titleize()
# relationships = Em.get(App[transition.targetName.split('.').shift().singularize().camelize().titleize()], "relationshipsByName")
# relationshipNames = []
# relationships.forEach (name, relationship) ->
# # console.log name, relationship
# relationshipNames.push(relationship.type.toString())
# relationshipNames = uniqueArray(relationshipNames)
# relationshipNames.forEach (name) =>
# @store.all(name.split(".").pop().camelize()).forEach (record) ->
# console.log "record", name, record
# @store.unloadAll('location')
# Attempt #2
# typeMap = App.store.typeMaps
# typeMapKeys = Object.keys(typeMap)
# typeMapKeys.forEach (key) ->
# console.log typeMap[key].records
# typeMap[key].records.forEach (rec) ->
# App.store.unloadRecord(rec)
# Attempt #3
# console.log 'keysList', App.store.recordArrayManager.filteredRecordArrays.keys.list
# for key in App.store.recordArrayManager.filteredRecordArrays.keys.list
# console.log 'key', key.toString().replace("App.", "")
# @store.unloadAll(key.toString().replace("App.",""))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment