1 class Manifest.Model extends ManifestBase.Base
\r
5 @json.attributes ||= {}
\r
6 @json.associations ||= {}
\r
8 @json.attributes.id = {
\r
15 @json.attributes.created_at = {
\r
18 @json.attributes.updated_at = {
\r
24 @attributes = ManifestBase.load_name_values this, @json, 'attributes', Manifest.ModelModule.Attribute
\r
25 @associations = ManifestBase.load_value this, @json, 'associations', Manifest.ModelModule.Association
\r
26 @list = ManifestBase.load_value this, @json, 'list', Manifest.ModelModule.List
\r
32 Manifest.item_name_to_model @name
\r
35 @classify.table_name
\r
37 valid_encode_columns: () ->
\r
39 _.each @attributes, (attribute, attribute_name) ->
\r
40 next if not attribute.type == 'text'
\r
41 r.push attribute_name
\r
45 return 'author' if @attributes.author_id
\r
46 return 'artist' if @attributes.artist_id
\r
49 content_model: () ->
\r
50 return true if @owner_type
\r
53 child_model_manifests: () ->
\r
55 _.each Manifest.items, (peta_manifest, peta_name) ->
\r
56 next if not peta_manifest.is_element
\r
57 next if not peta_manifest.parent_model_name == @name
\r
58 r.push Manifest.models[peta_name]
\r
62 _.map @child_model_manifests, (child_model_manifest) ->
\r
63 child_model_manifest.classify
\r
65 child_element_names: () ->
\r
66 _.map @child_models, (child_model) ->
\r
67 @associations.child_element_name(child_model)
\r
69 child_element_name: (item_name) ->
\r
70 @associations.child_element_name(child_model_manifest)
\r
72 class Manifest.ModelModule
\r