module

Marten::DB::Model::Table

Instance methods

get_field_value(field_name : String | Symbol)

Allows to read the value of a specific field.

This methods returns the value of the field corresponding to field_name. If the passed field_name doesn't match any existing field, a Marten::DB::Errors::UnknownField exception is raised.

Source
inspect(io)
Source
pk

Returns the primary key value.

Source
pk!

Returns the primary key value or raise NilAssertionError.

Source
pk=(val)

Allows to set the primary key value.

Source
pk?

Returns true if a primary key value is set on the record.

Source
set_field_value(field_name : String | Symbol, value : Field::Any | Model)

Allows to set the value of a specific field.

If the passed field_name doesn't match any existing field, a Marten::DB::Errors::UnknownField exception will be raised.

Source
set_field_values(values : Hash | NamedTuple)

Allows to set the values of multiple fields.

If one of the specified field names doesn't match any existing field, a Marten::DB::Errors::UnknownField exception will be raised.

Source
set_field_values

Allows to set the values of multiple fields.

If one of the specified field names doesn't match any existing field, a Marten::DB::Errors::UnknownField exception will be raised.

Source
to_s(io)
Source

Macros

field(*args, **kwargs)
Source
with_timestamp_fields

Allows to automatically configure creation and update timestamp fields.

This macro will contribute two model fields to the models it is applied to: one created_at field containing the creation time of the record, and one updated_at field containing the update time of the record (which is also refreshed every time the model is updated).

Source

Nested types