-<cfscript>
-	/*
-	* PRIVATE METHODS
-	*/
-
-	public any function $initModelClass(required string name, required string path) {
+<!--- PRIVATE METHODS --->
+
+<cffunction name="$initModelClass" returntype="any" access="public" output="false">
+	<cfargument name="name" type="string" required="true">
+	<cfargument name="path" type="string" required="true">
+	<cfscript>
+		var loc = {};
 		variables.wheels = {};
 		variables.wheels.errors = [];
 		variables.wheels.class = {};

		variables.wheels.class.automaticValidations = application.wheels.automaticValidations;
		setTableNamePrefix(get("tableNamePrefix"));
		table(LCase(pluralize(variables.wheels.class.modelName)));
		local.callbacks = "afterNew,afterFind,afterInitialization,beforeDelete,afterDelete,beforeSave,afterSave,beforeCreate,afterCreate,beforeUpdate,afterUpdate,beforeValidation,afterValidation,beforeValidationOnCreate,afterValidationOnCreate,beforeValidationOnUpdate,afterValidationOnUpdate";
		local.iEnd = ListLen(local.callbacks);
		for (local.i=1; local.i <= local.iEnd; local.i++)
		{
			variables.wheels.class.callbacks[ListGetAt(local.callbacks, local.i)] = ArrayNew(1);
		}
		local.validations = "onSave,onCreate,onUpdate";
		local.iEnd = ListLen(local.validations);
		for (local.i=1; local.i <= local.iEnd; local.i++)
		{
			variables.wheels.class.validations[ListGetAt(local.validations, local.i)] = ArrayNew(1);
		}

		variables.wheels.class.propertyList = "";

			variables.wheels.class.adapter = $assignAdapter();

			// get columns for the table
			loc.columns = variables.wheels.class.adapter.$getColumns(tableName());

			loc.processedColumns = "";
			loc.iEnd = loc.columns.recordCount;
			for (loc.i=1; loc.i <= loc.iEnd; loc.i++)
			{
				// set up properties and column mapping
				if (!ListFind(loc.processedColumns, loc.columns["column_name"][loc.i]))
				{
					// default the column to map to a property with the same name
					loc.property = loc.columns["column_name"][loc.i];
					for (loc.key in variables.wheels.class.mapping)
					{
						if (StructKeyExists(variables.wheels.class.mapping[loc.key], "type") && variables.wheels.class.mapping[loc.key].type == "column" && variables.wheels.class.mapping[loc.key].value == loc.property)
						{
							// developer has chosen to map this column to a property with a different name so set that here
							loc.property = loc.key;
							break;
						}
					}
					loc.type = SpanExcluding(loc.columns["type_name"][loc.i], "( ");

					// set the info we need for each property
					variables.wheels.class.properties[loc.property] = {};
					variables.wheels.class.properties[loc.property].dataType = loc.type;
					variables.wheels.class.properties[loc.property].type = variables.wheels.class.adapter.$getType(loc.type, loc.columns["decimal_digits"][loc.i]);
					variables.wheels.class.properties[loc.property].column = loc.columns["column_name"][loc.i];
					variables.wheels.class.properties[loc.property].scale = loc.columns["decimal_digits"][loc.i];

					// get a boolean value for whether this column can be set to null or not
					// if we don't get a boolean back we try to translate y/n to proper boolean values in cfml (yes/no)
					variables.wheels.class.properties[loc.property].nullable = Trim(loc.columns["is_nullable"][loc.i]);
					if (!IsBoolean(variables.wheels.class.properties[loc.property].nullable))
					{
						variables.wheels.class.properties[loc.property].nullable = ReplaceList(variables.wheels.class.properties[loc.property].nullable, "N,Y", "No,Yes");
					}

					variables.wheels.class.properties[loc.property].size = loc.columns["column_size"][loc.i];
					variables.wheels.class.properties[loc.property].label = Humanize(loc.property);
					variables.wheels.class.properties[loc.property].validationtype = variables.wheels.class.adapter.$getValidationType(variables.wheels.class.properties[loc.property].type);
					if (StructKeyExists(variables.wheels.class.mapping, loc.property))
					{
						if (StructKeyExists(variables.wheels.class.mapping[loc.property], "label"))
						{
							variables.wheels.class.properties[loc.property].label = variables.wheels.class.mapping[loc.property].label;
						}
						if (StructKeyExists(variables.wheels.class.mapping[loc.property], "defaultValue"))
						{
							variables.wheels.class.properties[loc.property].defaultValue = variables.wheels.class.mapping[loc.property].defaultValue;
						}
					}
					if (loc.columns["is_primarykey"][loc.i])
					{
						setPrimaryKey(loc.property);
					}
					if (variables.wheels.class.automaticValidations && !ListFindNoCase("#application.wheels.timeStampOnCreateProperty#,#application.wheels.timeStampOnUpdateProperty#,#application.wheels.softDeleteProperty#", loc.property))
					{
						loc.defaultValidationsAllowBlank = variables.wheels.class.properties[loc.property].nullable;

						// primary keys should be allowed to be blank
						if (ListFindNoCase(primaryKeys(), loc.property))
						{
							loc.defaultValidationsAllowBlank = true;
						}
						if (!ListFindNoCase(primaryKeys(), loc.property) && !variables.wheels.class.properties[loc.property].nullable && !Len(loc.columns["column_default_value"][loc.i]) && !$validationExists(property=loc.property, validation="validatesPresenceOf"))
						{
							validatesPresenceOf(properties=loc.property);
						}

						// always allowblank if a database default or validatesPresenceOf() has been set
						if (Len(loc.columns["column_default_value"][loc.i]) || $validationExists(property=loc.property, validation="validatesPresenceOf"))
						{
							loc.defaultValidationsAllowBlank = true;
						}

						// set length validations if the developer has not
						if (variables.wheels.class.properties[loc.property].validationtype == "string" && !$validationExists(property=loc.property, validation="validatesLengthOf"))
						{
							validatesLengthOf(properties=loc.property, allowBlank=loc.defaultValidationsAllowBlank, maximum=variables.wheels.class.properties[loc.property].size);
						}

						// set numericality validations if the developer has not
						if (ListFindNoCase("integer,float", variables.wheels.class.properties[loc.property].validationtype) && !$validationExists(property=loc.property, validation="validatesNumericalityOf"))
						{
							validatesNumericalityOf(properties=loc.property, allowBlank=loc.defaultValidationsAllowBlank, onlyInteger=(variables.wheels.class.properties[loc.property].validationtype == "integer"));
						}

						// set date validations if the developer has not (checks both dates or times as per the IsDate() function)
						if (variables.wheels.class.properties[loc.property].validationtype == "datetime" && !$validationExists(property=loc.property, validation="validatesFormatOf"))
						{
							validatesFormatOf(properties=loc.property, allowBlank=loc.defaultValidationsAllowBlank, type="date");
						}
					}
					variables.wheels.class.propertyList = ListAppend(variables.wheels.class.propertyList, loc.property);
					variables.wheels.class.columnList = ListAppend(variables.wheels.class.columnList, variables.wheels.class.properties[loc.property].column);
					loc.processedColumns = ListAppend(loc.processedColumns, loc.columns["column_name"][loc.i]);
				}
			}
			// raise error when no primary key has been defined for the table
