Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

53 lines (44 sloc) 1.619 kb
var <%= names.constructor.singular %> = function () {
this.defineProperties({
<% for(var i in properties) { -%>
<%# Hack: ID property will always be first so we will manually take care of not inserting -%>
<%# A leading comma -%>
<% if(i === 'id') { -%>
<%= i %>: {type: '<%= properties[i] %>', required: true}
<% } else { -%>
, <%= i %>: {type: '<%= properties[i] %>'}
<% } -%>
<% } -%>
});
/*
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.