Sha256: c58828bd0f124a09333d8d59ed6876f98b26ea9a4991a54d2a5fc554083498b9
Contents?: true
Size: 941 Bytes
Versions: 1
Compression:
Stored size: 941 Bytes
Contents
module MetaModel class HasAssociation include Neo4j::ActiveRel from_class 'MetaModel::Model' to_class 'MetaModel::Model' type 'has_association_to' # one_to_many refers to from_class has_many to_classes # many_to_one refers to from_class has_one to_class property :join_type, type: String validates_inclusion_of :join_type, :in => %w( many_to_one one_to_many many_to_many ) # Name of associations on each side property :name, type: String property :opposite_name, type: String property :relationship_type, type: String def from_model from_node end def to_model to_node end def from_model=(other) self.from_node = other end def to_model=(other) self.to_node = other end def from_model_id=(id) self.from_model = Model.find(id) end def to_model_id=(id) self.to_model = Model.find(id) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
neo4j-meta_model-0.0.1 | app/models/meta_model/has_association.rb |