Revision cdce3438
Added by Marc Dequènes over 15 years ago
- ID cdce34381ea443ecdc1a896752c74483ba5827ca
TODO | ||
---|---|---|
- display sort order
|
||
- display familly information (optional)
|
||
- binary fields: display presence and (later) allow download/upload to/from file
|
test.rb | ||
---|---|---|
return ""
|
||
end
|
||
|
||
def possible_relations
|
||
self.associations.collect {|assoc| assoc.to_s } - ['children']
|
||
end
|
||
|
||
def relations
|
||
self.associations.collect {|assoc| assoc.to_s }
|
||
rel_list = []
|
||
|
||
rel_list += self.class.presentation[:associated_relations] if self.class.presentation[:associated_relations]
|
||
|
||
aspects.each do |aspect|
|
||
aspect_data = self.class.mapper.get_aspect(aspect)
|
||
if defined?(aspect_data[:presentation][:associated_relations]) and aspect_data[:presentation][:associated_relations]
|
||
rel_list += aspect_data[:presentation][:associated_relations]
|
||
end
|
||
end
|
||
|
||
rel_list & possible_relations
|
||
end
|
||
|
||
def aspects
|
||
... | ... | |
attr_list = self.attributes.keys - ignored_attrs
|
||
|
||
aspects = self.aspects
|
||
|
||
# ignore children at the moment
|
||
rel_list = self.relations - ['children']
|
||
rel_list = self.possible_relations
|
||
|
||
# first pass to take aspects forced relations into account
|
||
obj_aspects = {}
|
||
... | ... | |
puts "--- Detected Info ---"
|
||
puts "aspects: " + item.aspects.sort.join(", ")
|
||
|
||
puts "--- Family ---"
|
||
puts "children: " + item.children.join(", ")
|
||
|
||
puts "--- Relations ---"
|
||
item.relations.each do |rel|
|
||
puts "#{rel}: " + item.send(rel).collect{|g| g.name }.join(", ")
|
Also available in: Unified diff
[evol] relations are now limited to what is really available in regard to aspects, and the list of possible (potential) relations can be retrieved; relations only include explicit links between objects, not family members (parent/siblings/children objects)