Created
April 18, 2011 17:05
-
-
Save topherfangio/925708 to your computer and use it in GitHub Desktop.
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 also find all records of a certain type and all its subclasses: | |
<javascript> | |
allRecords = MyApp.store.find(SC.Record); | |
</javascript> |
allRecords = MyApp.store.find(SC.Record); // Every record in the store (this will materialize them all- beware!)
fileRecords = MyApp.store.find(MyApp.File); // Returns all MyApp.File records
If you would like to get all records of a certain type and all it's subclasses, you need to do:
MyApp.File = MyApp.Blob.extend();
MyApp.Directory = MyApp.Blob.extend();
result = MyApp.store.find(SC.Query.local(MyApp.Blob)); // Returns all MyApp.Blob, MyApp.File, and MyApp.Directory records
allBlobs = MyApp.store.find(MyApp.Blob); // Returns _only_ MyApp.Blob
MyApp.Blob.isPolymorphic = YES; // with the new polymorphic framework!
allBlobTypedRecords = MyApp.store.find(MyApp.Blob); // same as record query!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This doesn't make a lot of sense to me. This leaves off the "records of a certain type". Can someone correct this please? I haven't used this feature of SC yet.