class

PlaceOS::Model::ModelBase

Inherits PlaceOS::Model::Associations < Neuroplastic < PgORM::Base < PgORM::Validators < PgORM::Table < PgORM::Persistence < PgORM::Associations < ActiveModel::Callbacks < ActiveModel::Validation < ActiveModel::Model < DB::Mappable < DB::Serializable < YAML::Serializable < JSON::Serializable < Reference < Object

Base class for all Engine models

Constants

CALLBACKS = { before_save: [do if self.id? else self.id = Utilities::IdGenerator.next(self) end end] of Nil, after_save: [] of Nil, before_create: [do if self.id? else self.id = Utilities::IdGenerator.next(self) end end] of Nil, after_create: [] of Nil, before_update: [] of Nil, after_update: [] of Nil, before_destroy: [] of Nil, after_destroy: [] of Nil, }

Base class for all Engine models

PRIMARY_KEY_TYPES = {} of Nil => Nil

macro level key => type

PRIMARY_KEYS = [{:id}]

Base class for all Engine models

Constructors

Base class for all Engine models

Source
new(pull : JSON::PullParser)

Base class for all Engine models

Source
new(rs : DB::ResultSet)

Base class for all Engine models

Source

Class methods

attributes

Returns all attribute keys.

from_rs(rs : DB::ResultSet)

Base class for all Engine models

Source
primary_key

Base class for all Engine models

Source

Instance methods

after_create

Base class for all Engine models

after_destroy

Base class for all Engine models

after_save

Base class for all Engine models

after_update

Base class for all Engine models

apply_defaults

Generate code to apply default values

assign_attributes(params : HTTP::Params | Hash(String, String) | Tuple(String, String))

Assign to multiple attributes via HTTP::Params.

assign_attributes(model : PlaceOS::Model::ModelBase)

Assign to multiple attributes from a model object

assign_attributes

Assign to multiple attributes.

attributes

Returns a Hash of all attribute values

attributes_tuple

Returns a NamedTuple of all attribute values.

before_create

Base class for all Engine models

before_destroy

Base class for all Engine models

before_save

Base class for all Engine models

before_update

Base class for all Engine models

invoke_props

Base class for all Engine models

persistent_attributes

Returns a Hash of all attributes that can be persisted.

primary_key

Base class for all Engine models

Source