2 class ElementNestableContent < Content
3 self.abstract_class = true
9 return nil if self._skip_load?
12 define_method("element_items") do |element_model|
13 self.__send__ self.class.my_manifest.associations.child_element_name(element_model)
15 define_method("elements_items") do
16 self.class.child_models.map {|element_model|
17 self.element_items element_model
28 self.elements_items.each do |item|
33 def post_attributes opt = {}
34 attr = self.copy_attributes(opt)
35 associations_attr = {}
36 self.class.child_models.each do |element_model|
37 name = self.class.my_manifest.associations.child_element_name(element_model) + '_attributes'
38 if self.class.my_manifest.associations.has_one?(element_model)
39 e = self.element_items(element_model).post_attributes(opt)
42 self.element_items(element_model).each do |element|
43 e[element.post_attribute_key] = element.post_attributes(opt)
46 associations_attr[name] = e
48 attr.merge! associations_attr