Class: Neo4j::MetaModel::Model
- Inherits:
-
MetaModelBase
- Object
- MetaModelBase
- Neo4j::MetaModel::Model
- Defined in:
- app/models/neo4j/meta_model/model.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#has_associations ⇒ Object
def property_ids properties(:p).pluck(p: :uuid) end.
- #to_param ⇒ Object
Class Method Details
.hierarchically ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/models/neo4j/meta_model/model.rb', line 27 def self.hierarchically Hash.new.tap do |result| model_parents = Hash[*all.query_as(:model).optional_match("model-[:inherits_from]->(parent)").pluck(:model, :parent).flatten] all.query_as(:model).where('NOT(model-[:inherits_from]->())').pluck(:model).each do |model| result[model] = {} end all.query_as(:model).match('p=model-[:inherits_from*1..]->()').pluck('nodes(p)').each do |path| path.reverse.inject(result) do |sub_result, model| sub_result[model] ||= {} sub_result[model] end end end end |
Instance Method Details
#has_associations ⇒ Object
def property_ids
properties(:p).pluck(p: :uuid)
end
23 24 25 |
# File 'app/models/neo4j/meta_model/model.rb', line 23 def has_associations assocs.each_rel.to_a end |
#to_param ⇒ Object
15 16 17 |
# File 'app/models/neo4j/meta_model/model.rb', line 15 def to_param self.class_name.tableize end |