module Ktistec::Model::InstanceMethods
Direct including types
- Account
- ActivityPub::Activity
- ActivityPub::Actor
- ActivityPub::Collection
- ActivityPub::Object
- FilterTerm
- Point
- Relationship
- Session
- Tag
- Task
Defined in:
framework/model.crConstructors
-
.new(options : Hash(String, Any)) forall Any
Initializes the new instance.
-
.new(**options)
Initializes the new instance.
Instance Method Summary
-
#==(other)
Returns true if all persistent properties are equal.
- #_run_validations
- #_save_model(skip_validation = false)
- #_serialize_graph(nodes, association = nil, index = nil, skip_associated = false)
- #_update_property(property, value)
-
#assign(options : Hash(String, Any)) forall Any
Bulk assigns properties.
-
#assign(**options)
Bulk assigns properties.
- #changed!(property : Symbol)
- #changed?(property : Symbol | Nil = nil)
- #clear!(property : Symbol | Nil = nil)
-
#destroy
Destroys the instance.
- #destroyed?
- #errors
- #inspect(io : IO)
- #new_record?
-
#save(skip_validation = false, skip_associated = false)
Saves the instance.
- #serialize_graph(skip_associated = false)
-
#table_name
Returns the table name.
- #to_h
- #to_json(json : JSON::Builder)
- #to_s(io : IO)
-
#valid?(skip_associated = false)
Returns true if the instance is valid.
-
#validate(skip_associated = false)
Validates the instance and returns any errors.
Macro Summary
-
belongs_to(name, primary_key = id, foreign_key = nil, class_name = nil, inverse_of = nil)
Specifies a one-to-one association with another model.
-
has_many(name, primary_key = id, foreign_key = nil, class_name = nil, inverse_of = nil)
Specifies a one-to-many association with another model.
-
has_one(name, primary_key = id, foreign_key = nil, class_name = nil, inverse_of = nil)
Specifies a one-to-one association with another model.
-
validates(property, &block)
Adds a validation to a property on an instance.
Constructor Detail
Instance Method Detail
Macro Detail
Specifies a one-to-one association with another model.
Specifies a one-to-many association with another model.
Specifies a one-to-one association with another model.
macro validates(property, &block)
#
Adds a validation to a property on an instance.
validates xyz { "is blank" if xyz.blank? }