Luna::BaseModel
Inherits Luna::Associations < Luna::StateMachine < Luna::Sti < ActiveModel::Validation < ActiveModel::Callbacks < ActiveModel::Model < DB::Mappable < DB::Serializable < YAML::Serializable < JSON::Serializable < Reference < Object
Constants
Constructors
Class methods
Returns all attribute keys.
Aggregates & helpers (class level)
Instance methods
Generate code to apply default values
Assign to multiple attributes via HTTP::Params.
Assign to multiple attributes from a model object
Assign to multiple attributes.
Returns a Hash of all attribute values
Returns a NamedTuple of all attribute values.
Returns a Hash of all attributes that can be persisted.
Wrap a block with callbacks for the appropriate crud operation.
Defined once here rather than once per subclass, and reached through the
before_*/after_* methods rather than by expanding __before_* inline.
These methods yield, and Crystal cannot dispatch a yielding method through
a pointer -- it inlines the body at each call site. Defining them per
subclass therefore meant that a run_*_callbacks call on an abstract
receiver emitted one inlined copy per concrete subclass, each containing a
type-id dispatch chain for every self call in the block. Nesting two of
them (run_update_callbacks { run_save_callbacks { ... } }) made that
quadratic in the number of models.
With a single definition there is one inlined copy, and before_* /
after_* are ordinary non-yielding overrides that share one dispatch
wrapper.
Default preload hooks. Association macros override these and chain with previous_def.