module Marten::DB::Model::Table
Direct including types
Defined in:
marten/db/model/table.crMacro Summary
- field(*args, **kwargs)
-
with_timestamp_fields
Allows to automatically configure creation and update timestamp fields.
Instance Method Summary
-
#get_field_value(field_name : String | Symbol)
Allows to read the value of a specific field.
- #inspect(io)
-
#pk
Returns the primary key value.
-
#pk!
Returns the primary key value or raise
NilAssertionError
. -
#pk=(val)
Allows to set the primary key value.
-
#set_field_value(field_name : String | Symbol, value : Field::Any | Model)
Allows to set the value of a specific field.
-
#set_field_values(values : Hash | NamedTuple)
Allows to set the values of multiple fields.
-
#set_field_values(**values)
Allows to set the values of multiple fields.
- #to_s(io)
Macro Detail
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).
Instance Method Detail
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.
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.
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.
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.