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
-
#hash(hasher)
Computes the hash for this instance.
- #inspect(io : IO)
- #new_record?
-
#reload!
Reloads the properties from the database.
-
#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.
-
derived(decl, *, aliased_to)
Specifies a property that is derived from another property.
-
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
Reloads the properties from the database.
Only reloads the persistent properties. Does not trigger any side effects. Does not ensure that the instance's state is otherwise valid.
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.
Adds a validation to a property on an instance.
validates xyz { "is blank" if xyz.blank? }