Module: Neo4j::MetaModel::ModelBase::ClassMethods

Defined in:
app/models/concerns/neo4j/meta_model/model_base.rb

Instance Method Summary collapse

Instance Method Details

#inherited(base) ⇒ Object



12
13
14
# File 'app/models/concerns/neo4j/meta_model/model_base.rb', line 12

def inherited(base)
  LOADED_CLASSES << base
end

#meta_model_classObject



16
17
18
# File 'app/models/concerns/neo4j/meta_model/model_base.rb', line 16

def meta_model_class
  name.gsub(/^Neo4j::MetaModel::/, '')
end

#naming_columnObject



20
21
22
23
24
25
# File 'app/models/concerns/neo4j/meta_model/model_base.rb', line 20

def naming_column
  # Probably want to allow the user to choose this
  column = (['name', 'title', 'description'] & attributes.keys).first

  column || Neo4j::MetaModel::Model.where(class_name: meta_model_class).first.properties.detect {|p| p.type == 'String' }.name
end