super\r
@json.attributes ||= {}\r
@json.associations ||= {}\r
- @json.list ||= {}\r
+ @json.table_name ||= Manifest.manifest().pluralize(@name)\r
@json.attributes.id = {\r
'type': 'number',\r
'primary_key': 1,\r
\r
init: () ->\r
super\r
+ @table_name = @json.table_name\r
@attributes = ManifestBase.load_name_values this, @json, 'attributes', Manifest.ModelModule.Attribute\r
@associations = ManifestBase.load_value this, @json, 'associations', Manifest.ModelModule.Association\r
- @list = ManifestBase.load_value this, @json, 'list', Manifest.ModelModule.List\r
\r
- model_name: () ->\r
+ item_name: () ->\r
@name\r
\r
classify: () ->\r
Manifest.item_name_to_model @name\r
\r
- table_name: () ->\r
- @classify.table_name\r
- \r
valid_encode_columns: () ->\r
r = []\r
_.each @attributes, (attribute, attribute_name) ->\r
\r
child_model_manifests: () ->\r
r = []\r
- _.each Manifest.items, (peta_manifest, peta_name) ->\r
- next if not peta_manifest.is_element\r
- next if not peta_manifest.parent_model_name == @name\r
- r.push Manifest.models[peta_name]\r
+ _.each Manifest.manifest().items, (peta_manifest, peta_name) =>\r
+ return if not peta_manifest.is_element()\r
+ return if peta_manifest.parent_item_name != @name\r
+ r.push Manifest.manifest().models[peta_name]\r
r\r
\r
child_models: () ->\r
- _.map @child_model_manifests, (child_model_manifest) ->\r
- child_model_manifest.classify\r
+ _.map @child_model_manifests(), (child_model_manifest) ->\r
+ child_model_manifest.classify()\r
\r
child_element_names: () ->\r
- _.map @child_models, (child_model) ->\r
+ _.map @child_models(), (child_model) ->\r
@associations.child_element_name(child_model)\r
\r
child_element_name: (item_name) ->\r
- @associations.child_element_name(child_model_manifest)\r
+ @associations.child_element_name(@child_model_manifest())\r
\r
class Manifest.ModelModule\r