Crecto::Model
Crecto::Model
class imposes the inherited
which imports the correct schema modules and sets up class wide variables and constants used for keeping track of associations and field names.schema "users", primary_key: false do
id
, created_at
, and updated_at
.field
macro. The field macro takes 2 arguments, the column name as a Symbol and the column type, and an optional options tuple.Json
fields can be both postgres json
or jsonb
types. If jsonb
is used, those fields can be queried using build-in postgres methods.nil
, in the case that you are using a NOT NULL
database constraint you can use the non-nillable attribute accessors.CAUTION: Mis-use of this could lead to Nil reference runtime exceptions