DBX::ORM::Schema
Inherits DBX::ORM::SchemaInjectFields / DBX::ORM::SchemaInjectForFinal / DBX::ORM::SchemaField / DBX::ORM::SchemaRelation / JSON::Serializable::Unmapped / JSON::Serializable / DB::Mappable / DB::Serializable / Reference / Object
Model Schema.
Constants
Constructors
Class methods
Returns the SQL fields of the model (for the relations) separated by a comma (table.column, ...).
Instance methods
Always returns this record's primary key value, even when the primary key
isn't named _pk.
Unique (virtual) key used to compare the uniqueness of models.
By default this method returns the primary key (_pk) value.
This method avoid to rely directly on the primary key in case there is none in the structure of the SQL table (even if there should always be one). Used in the relation algorithm. Also, can be useful when there is a need to check the uniqueness in other cases.
If for some reason your model does not have a primary key, you can override this method to return a unique result related to the fields in your table, for example:
@[DB::Field(ignore: true)]
@[JSON::Field(ignore: true)]
def _ukey
"#{self.group_id}.#{self.user_id}"
end