neo4jrb / activegraph

An active model wrapper for the Neo4j Graph Database for Ruby.
http://neo4jrb.io
MIT License
1.4k stars 276 forks source link

How to globally set model id method #1581

Open am17torres opened 4 years ago

am17torres commented 4 years ago

According to the docs:

You can define a global or per-model generation methods if you do not want to use the default.

I'd like to know how to do this.

I am not interested in changing the property name, rather, I'd like to provide a function that generates a shorter id such as https://github.com/peterhellberg/hashids.rb.

Additional information which could be helpful if relevant to your issue:

Code example (inline, gist, or repo)

Runtime information:

Neo4j database version: (3.5.14) neo4j gem version: (9.6.1) neo4j-core gem version: (9.0.0)

klobuczek commented 4 years ago

@am17torres as far as I can tell this was not intended as part of the public API but if you look through the code I am sure you can find a way to override that behavior. After all, it's ruby and nearly everything is possible.