From 7d37524f945d58746ac562de9ac61f3db1fe876d Mon Sep 17 00:00:00 2001 From: GroMobi Date: Fri, 15 Feb 2013 07:31:06 -0800 Subject: [PATCH] Create user_icons.js Created a model based on table 2 (user_icons) following along with your example. --- .../app/models/user_icons.js | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Alloy SQL Model Example/app/models/user_icons.js diff --git a/Alloy SQL Model Example/app/models/user_icons.js b/Alloy SQL Model Example/app/models/user_icons.js new file mode 100644 index 0000000..f92cf41 --- /dev/null +++ b/Alloy SQL Model Example/app/models/user_icons.js @@ -0,0 +1,38 @@ +exports.definition = { + + config: { + "columns": { + "user_icon_id":"INT PRIMARY KEY AUTOINCREMENT", + "user_id":"tinyint", + "icon_id":"int", + "updated":"datetime" + }, + "adapter": { + "type": "sql", + "collection_name": "user_icons", + "idAttribute": "user_icon_id" + } + }, + + extendModel: function(Model) { + _.extend(Model.prototype, { + + // extended functions go here + + }); // end extend + + return Model; + }, + + + extendCollection: function(Collection) { + _.extend(Collection.prototype, { + + // extended functions go here + + }); // end extend + + return Collection; + } + +}