Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

59 lines (49 sloc) 1.78 kB
var <%= names.constructor.singular %> = function () {
this.defineProperties({
<% for (var i in properties) { -%>
<% if (properties[i].name && properties[i].name !== 'id') { -%>
<% if (i === 'default') { -%>
<%= properties[i].name %>: {type: '<%= properties[i].type %>', required: true},
<% } else { -%>
<%= properties[i].name %>: {type: '<%= properties[i].type %>'},
<% } -%>
<% } -%>
<% } -%>
});
<% for(var i in properties) { -%>
<% if(properties[i].name === 'id' && properties[i].type === 'int') { -%>
this.autoIncrementId = true;
<% } -%>
<% } -%>
/*
this.property('login', 'string', {required: true});
this.property('password', 'string', {required: true});
this.property('lastName', 'string');
this.property('firstName', 'string');
this.validatesPresent('login');
this.validatesFormat('login', /[a-z]+/, {message: 'Subdivisions!'});
this.validatesLength('login', {min: 3});
// Use with the name of the other parameter to compare with
this.validatesConfirmed('password', 'confirmPassword');
// Use with any function that returns a Boolean
this.validatesWithFunction('password', function (s) {
return s.length > 0;
});
// Can define methods for instances like this
this.someMethod = function () {
// Do some stuff
};
*/
};
/*
// Can also define them on the prototype
<%= names.constructor.singular %>.prototype.someOtherMethod = function () {
// Do some other stuff
};
// Can also define static methods and properties
<%= names.constructor.singular %>.someStaticMethod = function () {
// Do some other stuff
};
<%= names.constructor.singular %>.someStaticProperty = 'YYZ';
*/
<%= names.constructor.singular %> = geddy.model.register('<%= names.constructor.singular %>', <%= names.constructor.singular %>);
Jump to Line
Something went wrong with that request. Please try again.