Sha256: 7d4c905f811273fd13af816305baad82907444ab5ea4526442fc5a97bd3c2a20
Contents?: true
Size: 1.42 KB
Versions: 6
Compression:
Stored size: 1.42 KB
Contents
Description: This creates Apache AGE nodes that work seamlessly with Rails. A node can be created with or without a namespace. See the below examples. Example: `bin/rails g apache_age:node Cat name age:integer` This creates: `app/nodes/cat.rb` with the contents: ``` class Cat include ApacheAge::Entities::Vertex attribute :name, :string attribute :age, :integer validates :name, presence: true validates :age, presence: true # unique node validator (remove any attributes that are not important to uniqueness) validates_with( ApacheAge::Validators::UniqueVertexValidator, attributes: [:name, :age] ) end ``` A namespace can also be used: `bin/rails g apache_age:node Animals/Cat name age:integer` This creates: `app/nodes/animals/cat.rb` with the contents ``` class Animals::Cat include ApacheAge::Entities::Vertex attribute :name, :string attribute :age, :integer validates :name, presence: true validates :age, presence: true # unique node validator (remove any attributes that are not important to uniqueness) validates_with( ApacheAge::Validators::UniqueVertexValidator, attributes: [:name, :age] ) end ```
Version data entries
6 entries across 3 versions & 1 rubygems