Where do I subclass SC.Record?
- by Jake
I'm using SproutCore and going through the Todos tutorial on http://wiki.sproutcore.com/Todos+06-Building+with+Rails. SproutCore and Rails use different names for the primary key on a model (Sproutcore = 'guid', Rails = 'id').
The tutorial gives directions to Adjust Rails JSON output, but in my app that I'm planning on building, I cannot do this because sproutcore is only one of a couple interfaces used to interact with the Rails app. As an alternate option, the tutorial gives the following directions:
Option 2: Set primaryKey in your Sproutcore model class
You can subclass SC.Record and set the primaryKey of your sublcass to "id". Your Todo-
Object then needs to extend from e.g. App.Rails.Record.
App.Rails.Record = SC.Record.extend({
primaryKey : "id" // Extend your records from App.Rails.Record instead of SC.Record.
});
Where should I subclass SC.Record (i.e. in what file) such that it is properly read and included?