module ActiveGraph::Node::IdProperty
This module makes it possible to use other IDs than the build it neo4j id (neo_id)
@example using generated UUIDs
class Person include ActiveGraph::Node # creates a 'secret' neo4j property my_uuid which will be used as primary key id_property :my_uuid, auto: :uuid end
@example using user defined ids
class Person include ActiveGraph::Node property :title validates :title, :presence => true id_property :title_id, on: :title_to_url def title_to_url self.title.urlize # uses https://github.com/cheef/string-urlize gem end end
@example using already exsting ids that you don't want a constraint added to
class Person include ActiveGraph::Node property :title validates :title, :presence => true id_property :id, on: :id_builder, constraint: false def id_builder # only need to fill this out if you're gonna write to the db end end