I'm hoping someone can help me with this problem. I'm fetching a very basic record from the sqlite db (iPhone 5 emulator). The JSON of the object has the data, but if I try to fetch the attributes, the non-id one is undefined.
Log results:
[INFO] : id = 1; [INFO] : "secondary_id" = "653D552C-13C0-4D12-947A-B42697BF3ADC"; [INFO] : id -> 1
[INFO] : secondary_id -> undefined
model:
exports.definition = { config: { "columns": { "secondary_id": "TEXT", "id": "INTEGER PRIMARY KEY AUTOINCREMENT" }, "defaults": { "secondary_id": "", "id": null }, adapter: { type: "sql", collection_name: "DeviceSettings", idAttribute:'id' } }, extendModel: function(Model) { _.extend(Model.prototype, { });
return Model;
},
extendCollection: function(Collection) {
_.extend(Collection.prototype, {
});
return Collection;
}
};
access code:
var device = Alloy.createModel('DeviceSettings');
device.fetch({id: 1});
console.info(device.toJSON());
console.info('id -> ' + device.id);
console.info('secondary_id -> ' + device.secondary_id);
It's very likely I'm doing something obvious and stupid... but I can't seem to figure out what obvious stupid thing I'm doing.
Thanks!