class

Marten::DB::Field::ManyToOne

Inherits Marten::DB::Field::Base / Reference / Object

Constructors

Instance methods

default

Returns the default value of the field if any.

Source
foreign_key?

Returns a boolean indicating whether the column is a foreign key.

Source
from_db(value) : Marten::DB::Field::ReferenceDBTypes

Converts the raw DB value to the corresponding field value.

Source
from_db_result_set(result_set : ::DB::ResultSet) : Marten::DB::Field::ReferenceDBTypes

Extracts the field value from a DB result set and returns the right object corresponding to this value.

Source
on_delete
Source
relation?

Returns true if the field is a relation.

By default this method will always return false. It should be overriden if the field is intended to handle a relation with another model (eg. like many to one or one to one fields).

Source
relation_name

Returns the name of the relation on the model associated with the field.

This method will raise a NotImplementedError exception by default and should only be overriden if the #relation? method returns true (this is the case for fields such as many to one, one to one, etc).

Source
to_column

Returns a migration column object corresponding to the field at hand.

Source
to_db(value) : ::DB::Any

Converts the field value to the corresponding DB value.

Source