Sha256: 3a38e6123184cb1604c972b4b670424411314f2c726e6acfb53880f0182ad844
Contents?: true
Size: 1.43 KB
Versions: 5
Compression:
Stored size: 1.43 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::Node attribute :full_name, :string attribute :birthdate, :date validates :full_name, presence: true validates :birthdate, presence: true # unique node validator (remove any attributes that are not important to uniqueness) validates_with( ApacheAge::Validators::UniqueNode, attributes: [:full_name, :birthdate] ) 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::Node 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::UniqueNode, attributes: [:name, :age] ) end ```
Version data entries
5 entries across 5 versions & 1 rubygems