Created
December 5, 2014 21:12
-
-
Save elidupuis/d6b236df6d5f4dfb87b7 to your computer and use it in GitHub Desktop.
Dynamically reload all hasMany relationships for a model.
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
/** | |
* You can use this in a model or afterModel hook... | |
* see http://emberjs.com/api/data/classes/DS.Model.html#method_eachRelationship | |
* | |
* Not really tested or sure if this is a good idea... just had the thought and wanted to record it. | |
*/ | |
model.eachRelationship(function(name, relationship) { | |
if (relationship.kind === 'hasMany' && relationship.options.async) { | |
this.get(name).reload(); | |
} | |
}, model); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment