Method: WeaviateRecord::Base.create

Defined in:
lib/weaviate_record/base.rb

.create(**attributes_hash) ⇒ Object

Creates a new weaviate record and saves it and returns the record. Takes a key value pair of attributes that the record should be initialized with. If the record is not saved, it returns the unsaved record object with errors.

Example:

Article.create(title: 'Hello World', content: 'This is the content of the article')

# => #<Article:0x0000000105468ab0 id: "8280210b-9372-4e70-a045-beb7c12a9a24" ...>


28
29
30
31
32
# File 'lib/weaviate_record/base.rb', line 28

def create(**attributes_hash)
  record = new(**attributes_hash)
  record.save
  record
end