1 ManifestBase.require_modules "manifest/model/association/",
2 %w|belongs_to has_many has_one|
6 class Association < ManifestBase::Values
7 include AssociationModule
9 attr :belongs_to, :has_many, :has_one
13 @values['belongs_to'] ||= {}
14 @values['has_many'] ||= {}
15 @values['has_one'] ||= {}
20 @belongs_to = ManifestBase.load_name_values self, @values, 'belongs_to', BelongsTo
21 @has_many = ManifestBase.load_name_values self, @values, 'has_many', HasMany
22 @has_one = ManifestBase.load_name_values self, @values, 'has_one', HasOne
30 @belongs_to.each do |name, belongs_to_manifest|
31 next unless @parent.classify.element?
32 if @parent.classify.my_peta.type == 'element'
33 next unless belongs_to_manifest.model.my_peta.type == 'root'
35 if @parent.classify.my_peta.type == 'leaf'
36 next unless belongs_to_manifest.model.my_peta.type == 'binder'
38 yield belongs_to_manifest.model
42 def child_element_name child_model
43 if @has_one[child_model.item_name]
46 child_model.table_name