class Booking

Included Modules

Extended Modules

Defined in:

models/booking.cr

Constant Summary

COLUMNS = {"id" => {type: Int64, primary: true, converter: "Int64", db_column_name: "id", crystal_variable_name: id, presence: false, mass_assign: true}, "user_id" => {type: String, primary: false, converter: "String", db_column_name: "user_id", crystal_variable_name: user_id, presence: true, mass_assign: true}, "user_email" => {type: String, primary: false, converter: "String", db_column_name: "user_email", crystal_variable_name: user_email, presence: true, mass_assign: true}, "user_name" => {type: String, primary: false, converter: "String", db_column_name: "user_name", crystal_variable_name: user_name, presence: true, mass_assign: true}, "asset_id" => {type: String, primary: false, converter: "String", db_column_name: "asset_id", crystal_variable_name: asset_id, presence: true, mass_assign: true}, "zones" => {type: Array(String) | ::Nil, primary: false, converter: "Array(String)", db_column_name: "zones", crystal_variable_name: zones, presence: true, mass_assign: true}, "booking_type" => {type: String, primary: false, converter: "String", db_column_name: "booking_type", crystal_variable_name: booking_type, presence: true, mass_assign: true}, "booking_start" => {type: Int64, primary: false, converter: "Int64", db_column_name: "booking_start", crystal_variable_name: booking_start, presence: true, mass_assign: true}, "booking_end" => {type: Int64, primary: false, converter: "Int64", db_column_name: "booking_end", crystal_variable_name: booking_end, presence: true, mass_assign: true}, "timezone" => {type: String | ::Nil, primary: false, converter: "String", db_column_name: "timezone", crystal_variable_name: timezone, presence: true, mass_assign: true}, "title" => {type: String | ::Nil, primary: false, converter: "String", db_column_name: "title", crystal_variable_name: title, presence: true, mass_assign: true}, "description" => {type: String | ::Nil, primary: false, converter: "String", db_column_name: "description", crystal_variable_name: description, presence: true, mass_assign: true}, "checked_in" => {type: Bool, primary: false, converter: "Bool", db_column_name: "checked_in", crystal_variable_name: checked_in, presence: false, mass_assign: true}, "checked_in_at" => {type: Int64 | ::Nil, primary: false, converter: "Int64", db_column_name: "checked_in_at", crystal_variable_name: checked_in_at, presence: true, mass_assign: true}, "checked_out_at" => {type: Int64 | ::Nil, primary: false, converter: "Int64", db_column_name: "checked_out_at", crystal_variable_name: checked_out_at, presence: true, mass_assign: true}, "rejected" => {type: Bool, primary: false, converter: "Bool", db_column_name: "rejected", crystal_variable_name: rejected, presence: false, mass_assign: true}, "rejected_at" => {type: Int64 | ::Nil, primary: false, converter: "Int64", db_column_name: "rejected_at", crystal_variable_name: rejected_at, presence: true, mass_assign: true}, "approved" => {type: Bool, primary: false, converter: "Bool", db_column_name: "approved", crystal_variable_name: approved, presence: false, mass_assign: true}, "approved_at" => {type: Int64 | ::Nil, primary: false, converter: "Int64", db_column_name: "approved_at", crystal_variable_name: approved_at, presence: true, mass_assign: true}, "approver_id" => {type: String | ::Nil, primary: false, converter: "String", db_column_name: "approver_id", crystal_variable_name: approver_id, presence: true, mass_assign: true}, "approver_email" => {type: String | ::Nil, primary: false, converter: "String", db_column_name: "approver_email", crystal_variable_name: approver_email, presence: true, mass_assign: true}, "approver_name" => {type: String | ::Nil, primary: false, converter: "String", db_column_name: "approver_name", crystal_variable_name: approver_name, presence: true, mass_assign: true}, "booked_by_id" => {type: String, primary: false, converter: "String", db_column_name: "booked_by_id", crystal_variable_name: booked_by_id, presence: true, mass_assign: true}, "booked_by_email" => {type: String, primary: false, converter: "String", db_column_name: "booked_by_email", crystal_variable_name: booked_by_email, presence: true, mass_assign: true}, "booked_by_name" => {type: String, primary: false, converter: "String", db_column_name: "booked_by_name", crystal_variable_name: booked_by_name, presence: true, mass_assign: true}, "booked_from" => {type: String | ::Nil, primary: false, converter: "String", db_column_name: "booked_from", crystal_variable_name: booked_from, presence: true, mass_assign: true}, "process_state" => {type: String | ::Nil, primary: false, converter: "String", db_column_name: "process_state", crystal_variable_name: process_state, presence: true, mass_assign: true}, "last_changed" => {type: Int64 | ::Nil, primary: false, converter: "Int64", db_column_name: "last_changed", crystal_variable_name: last_changed, presence: true, mass_assign: true}, "created" => {type: Int64 | ::Nil, primary: false, converter: "Int64", db_column_name: "created", crystal_variable_name: created, presence: true, mass_assign: true}, "extension_data" => {type: JSON::Any, primary: false, converter: "JSON::Any", db_column_name: "extension_data", crystal_variable_name: extension_data, presence: false, mass_assign: true}, "tenant_id" => {type: Int64, primary: false, converter: "Int64", db_column_name: "tenant_id", crystal_variable_name: tenant_id, presence: false, mass_assign: true}} of Nil => Nil
POLYMORPHISM_SETTINGS = {} of Nil => Nil
RELATION_FILTERS = {} of String => (Clear::SQL::SelectBuilder ->)

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.create(x : Hash) : self #

[View source]
def self.create(x : NamedTuple) : self #

[View source]
def self.create(**args) : self #

Build and new model and save it. Returns the model.

The model may not be saved due to validation failure; check the returned model errors? and persisted? flags.


[View source]
def self.create!(a : Hash) : self #

[View source]
def self.create!(x : NamedTuple) : self #

[View source]
def self.create!(**args) : self #

Build and new model and save it. Returns the model.

Returns the newly inserted model Raises an exception if validation failed during the saving process.


[View source]
def self.new(h : Hash(String, _), cache : Clear::Model::QueryCache | Nil = nil, persisted = false, fetch_columns = false) #

[View source]
def self.new(json : JSON::Any, cache : Clear::Model::QueryCache | Nil = nil, persisted = false) #

[View source]
def self.new(t : NamedTuple, persisted = false) #

[View source]
def self.new #

[View source]

Class Method Detail

def self.__call_relation_filter__(name : String, query : Clear::SQL::SelectBuilder) #

[View source]
def self.__relation_filter_attendees__(query) #

def self.booked_between(tenant_id, period_start, period_end) #

[View source]
def self.build(**x : **T) forall T #

Build a new empty model and fill the columns using the NamedTuple in argument.

Returns the new model


[View source]
def self.by_tenant(tenant_id) #

[View source]
def self.by_user_email(user_email) #

[View source]
def self.by_user_id(user_id) #

[View source]
def self.by_user_or_email(user_id_value, user_email_value, include_booked_by) #

[View source]
def self.by_zones(zones) #

Bookings have the zones in an array.

In case of multiple zones as input, we return all bookings that have any of the input zones in their zones array


[View source]
def self.columns #

[View source]
def self.connection : String #

Define on which connection the model is living. Useful in case of models living in different databases.

Is set to "default" by default.

See Clear::SQL#init(URI, *opts) for more information about multi-connections.

Example:

 Clear::SQL.init("postgres://postgres@localhost/database_1", connection_pool_size: 5)
 Clear::SQL.init("secondary", "postgres://postgres@localhost/database_2", connection_pool_size: 5)

class ModelA
  include Clear::Model

  # Performs all the queries on `database_1`
  # self.connection = "default"
  column id : Int32, primary: true, presence: false
  column title : String
end

class ModelB
  include Clear::Model

  # Performs all the queries on `database_2`
  self.connection = "secondary"

  column id : Int32, primary: true, presence: false
end

def self.connection=(connection : String) #

Define on which connection the model is living. Useful in case of models living in different databases.

Is set to "default" by default.

See Clear::SQL#init(URI, *opts) for more information about multi-connections.

Example:

 Clear::SQL.init("postgres://postgres@localhost/database_1", connection_pool_size: 5)
 Clear::SQL.init("secondary", "postgres://postgres@localhost/database_2", connection_pool_size: 5)

class ModelA
  include Clear::Model

  # Performs all the queries on `database_1`
  # self.connection = "default"
  column id : Int32, primary: true, presence: false
  column title : String
end

class ModelB
  include Clear::Model

  # Performs all the queries on `database_2`
  self.connection = "secondary"

  column id : Int32, primary: true, presence: false
end

def self.create(x : Array(NamedTuple)) : Array(self) #

Multi-models creation. See Collection#create(**args)

Returns the list of newly created model.

Each model will call an INSERT query. You may want to use Collection#import to insert multiple model more efficiently in one query.


[View source]
def self.create!(x : Array(NamedTuple)) : Array(self) #

Multi-models creation. See Collection#create!(**args)

Returns the list of newly created model. Raises exception if any of the model has validation error.


[View source]
def self.create_from_json(string_or_io : String | IO, trusted : Bool = false) #

Create a new model from json and save it. Returns the model.

The model may not be saved due to validation failure; check the returned model errors? and persisted? flags. Trusted flag set to true will allow mass assignment without protection, FALSE by default


def self.create_from_json!(string_or_io : String | IO, trusted : Bool = false) #

Create a new model from json and save it. Returns the model.

Returns the newly inserted model Raises an exception if validation failed during the saving process. Trusted flag set to true will allow mass assignment without protection, FALSE by default


def self.find(x) #

Returns a model using primary key equality Returns nil if not found.


[View source]
def self.find!(x) #

Returns a model using primary key equality. Raises error if the model is not found.


[View source]
def self.from_json(string_or_io : String | IO, trusted : Bool = false) #

Create a new empty model and fill the columns from json. Returns the new model

Trusted flag set to true will allow mass assignment without protection, FALSE by default


def self.full_table_name #

returns the fully qualified and escaped name for this table. add schema if schema is different from 'public' (default schema)

ex: "schema"."table"


[View source]
def self.import(array : Enumerable(self), on_conflict : Clear::SQL::InsertQuery -> | Nil = nil) #

Import a bulk of models in one SQL insert query. Each model must be non-persisted.

on_conflict callback can be optionnaly turned on to manage constraints of the database.

Note: Old models are not modified. This method return a copy of the models as saved in the database.

Example:


 users = [ User.new(id: 1), User.new(id: 2), User.new(id: 3)]
 users = User.import(users)

[View source]
def self.is_approved(value) #

[View source]
def self.is_checked_in(value) #

[View source]
def self.is_created_after(time) #

[View source]
def self.is_created_before(time) #

[View source]
def self.is_extension_data(value) #

[View source]
def self.is_rejected(value) #

[View source]
def self.is_state(state) #

[View source]
def self.polymorphic? : Bool #

def self.query #

Return a new empty query SELECT * FROM [my_model_table]. Can be refined after that.


[View source]
def self.read_only=(read_only : Bool) #

def self.read_only? : Bool #

def self.schema : Clear::SQL::Symbolic | Nil #

Define the current schema used in PostgreSQL. The value is nil by default, which lead to non-specified schema during the querying, and usage of "public" by PostgreSQL.

This property can be redefined on initialization. Example:

  class MyModel
    include Clear::Model

    self.schema = "my_schema"
  end
  MyModel.query.to_sql # SELECT * FROM "my_schema"."my_models"

def self.schema=(schema : Clear::SQL::Symbolic | Nil) #

Define the current schema used in PostgreSQL. The value is nil by default, which lead to non-specified schema during the querying, and usage of "public" by PostgreSQL.

This property can be redefined on initialization. Example:

  class MyModel
    include Clear::Model

    self.schema = "my_schema"
  end
  MyModel.query.to_sql # SELECT * FROM "my_schema"."my_models"

def self.table : Clear::SQL::Symbolic #

Return the table name setup for this model. By convention, the class name is by default equals to the pluralized underscored string form of the model name. Example:

  MyModel => "my_models"
  Person => "people"
  Project::Info => "project_infos"

The property can be updated at initialization to a custom table name:

  class MyModel
    include Clear::Model

    self.table = "another_table_name"
  end
  MyModel.query.to_sql # SELECT * FROM "another_table_name"

def self.table=(table : Clear::SQL::Symbolic) #

Return the table name setup for this model. By convention, the class name is by default equals to the pluralized underscored string form of the model name. Example:

  MyModel => "my_models"
  Person => "people"
  Project::Info => "project_infos"

The property can be updated at initialization to a custom table name:

  class MyModel
    include Clear::Model

    self.table = "another_table_name"
  end
  MyModel.query.to_sql # SELECT * FROM "another_table_name"

Instance Method Detail

def _cached_attendees : Array(Attendee) | Nil #

def _cached_tenant : Tenant | Nil #

def approved : Bool #

Returns the value of #approved column or throw an exception if the column is not defined.


def approved=(x : Bool) #

Setter for #approved column.


def approved_at : Int64 | Nil #

Returns the value of #approved_at column or throw an exception if the column is not defined.


def approved_at=(x : Int64 | Nil) #

Setter for #approved_at column.


def approved_at_column : Clear::Model::Column(Int64 | Nil, Clear::Model::Converter::Int64Converter) #

Returns the column object used to manage #approved_at field

See Clear::Model::Column


def approved_column : Clear::Model::Column(Bool, Clear::Model::Converter::BoolConverter) #

Returns the column object used to manage #approved field

See Clear::Model::Column


def approver_email : String | Nil #

Returns the value of #approver_email column or throw an exception if the column is not defined.


def approver_email=(x : String | Nil) #

Setter for #approver_email column.


def approver_email_column : Clear::Model::Column(String | Nil, Clear::Model::Converter::StringConverter) #

Returns the column object used to manage #approver_email field

See Clear::Model::Column


def approver_id : String | Nil #

Returns the value of #approver_id column or throw an exception if the column is not defined.


def approver_id=(x : String | Nil) #

Setter for #approver_id column.


def approver_id_column : Clear::Model::Column(String | Nil, Clear::Model::Converter::StringConverter) #

Returns the column object used to manage #approver_id field

See Clear::Model::Column


def approver_name : String | Nil #

Returns the value of #approver_name column or throw an exception if the column is not defined.


def approver_name=(x : String | Nil) #

Setter for #approver_name column.


def approver_name_column : Clear::Model::Column(String | Nil, Clear::Model::Converter::StringConverter) #

Returns the column object used to manage #approver_name field

See Clear::Model::Column


def as_h : AsHNamedTuple #

[View source]
def asset_id : String #

Returns the value of #asset_id column or throw an exception if the column is not defined.


def asset_id=(x : String) #

Setter for #asset_id column.


def asset_id_column : Clear::Model::Column(String, Clear::Model::Converter::StringConverter) #

Returns the column object used to manage #asset_id field

See Clear::Model::Column


def attendees : Attendee::Collection #

The method attendees is a has_many relation to Attendee


def attributes : Hash(String, Clear::SQL::Any) #

Attributes, used when fetch_columns is true


def booked_by_email : String #

Returns the value of #booked_by_email column or throw an exception if the column is not defined.


def booked_by_email=(x : String) #

Setter for #booked_by_email column.


def booked_by_email_column : Clear::Model::Column(String, Clear::Model::Converter::StringConverter) #

Returns the column object used to manage #booked_by_email field

See Clear::Model::Column


def booked_by_id : String #

Returns the value of #booked_by_id column or throw an exception if the column is not defined.


def booked_by_id=(x : String) #

Setter for #booked_by_id column.


def booked_by_id_column : Clear::Model::Column(String, Clear::Model::Converter::StringConverter) #

Returns the column object used to manage #booked_by_id field

See Clear::Model::Column


def booked_by_name : String #

Returns the value of #booked_by_name column or throw an exception if the column is not defined.


def booked_by_name=(x : String) #

Setter for #booked_by_name column.


def booked_by_name_column : Clear::Model::Column(String, Clear::Model::Converter::StringConverter) #

Returns the column object used to manage #booked_by_name field

See Clear::Model::Column


def booked_from : String | Nil #

Returns the value of #booked_from column or throw an exception if the column is not defined.


def booked_from=(x : String | Nil) #

Setter for #booked_from column.


def booked_from_column : Clear::Model::Column(String | Nil, Clear::Model::Converter::StringConverter) #

Returns the column object used to manage #booked_from field

See Clear::Model::Column


def booking_end : Int64 #

Returns the value of #booking_end column or throw an exception if the column is not defined.


def booking_end=(x : Int64) #

Setter for #booking_end column.


def booking_end_column : Clear::Model::Column(Int64, Clear::Model::Converter::Int64Converter) #

Returns the column object used to manage #booking_end field

See Clear::Model::Column


def booking_start : Int64 #

Returns the value of #booking_start column or throw an exception if the column is not defined.


def booking_start=(x : Int64) #

Setter for #booking_start column.


def booking_start_column : Clear::Model::Column(Int64, Clear::Model::Converter::Int64Converter) #

Returns the column object used to manage #booking_start field

See Clear::Model::Column


def booking_type : String #

Returns the value of #booking_type column or throw an exception if the column is not defined.


def booking_type=(x : String) #

Setter for #booking_type column.


def booking_type_column : Clear::Model::Column(String, Clear::Model::Converter::StringConverter) #

Returns the column object used to manage #booking_type field

See Clear::Model::Column


def cache : Clear::Model::QueryCache | Nil #

def changed? #

Return true if the model is dirty (e.g. one or more fields have been changed.). Return false otherwise.


def checked_in : Bool #

Returns the value of #checked_in column or throw an exception if the column is not defined.


def checked_in=(x : Bool) #

Setter for #checked_in column.


def checked_in_at : Int64 | Nil #

Returns the value of #checked_in_at column or throw an exception if the column is not defined.


def checked_in_at=(x : Int64 | Nil) #

Setter for #checked_in_at column.


def checked_in_at_column : Clear::Model::Column(Int64 | Nil, Clear::Model::Converter::Int64Converter) #

Returns the column object used to manage #checked_in_at field

See Clear::Model::Column


def checked_in_column : Clear::Model::Column(Bool, Clear::Model::Converter::BoolConverter) #

Returns the column object used to manage #checked_in field

See Clear::Model::Column


def checked_out_at : Int64 | Nil #

Returns the value of #checked_out_at column or throw an exception if the column is not defined.


def checked_out_at=(x : Int64 | Nil) #

Setter for #checked_out_at column.


def checked_out_at_column : Clear::Model::Column(Int64 | Nil, Clear::Model::Converter::Int64Converter) #

Returns the column object used to manage #checked_out_at field

See Clear::Model::Column


def clear_change_flags #

Reset the #changed? flag on all columns

The model behave like its not dirty anymore and call to save would apply no changes.

Returns self


def created : Int64 | Nil #

Returns the value of #created column or throw an exception if the column is not defined.


def created=(x : Int64 | Nil) #

Setter for #created column.


def created_column : Clear::Model::Column(Int64 | Nil, Clear::Model::Converter::Int64Converter) #

Returns the column object used to manage #created field

See Clear::Model::Column


def description : String | Nil #

Returns the value of #description column or throw an exception if the column is not defined.


def description=(x : String | Nil) #

Setter for #description column.


def description_column : Clear::Model::Column(String | Nil, Clear::Model::Converter::StringConverter) #

Returns the column object used to manage #description field

See Clear::Model::Column


def extension_data : JSON::Any #

Returns the value of #extension_data column or throw an exception if the column is not defined.


def extension_data=(x : JSON::Any) #

Setter for #extension_data column.


def extension_data_column : Clear::Model::Column(JSON::Any, Clear::Model::Converter::JSON::AnyConverter) #

Returns the column object used to manage #extension_data field

See Clear::Model::Column


def id : Int64 #

Returns the value of #id column or throw an exception if the column is not defined.


def id=(x : Int64) #

Setter for #id column.


def id_column : Clear::Model::Column(Int64, Clear::Model::Converter::Int64Converter) #

Returns the column object used to manage #id field

See Clear::Model::Column


def invalidate_caches #

Invalidate local-to-relation cache and eager-loading cache. Useful to forcefully query again when calling relation defined method


def last_changed : Int64 | Nil #

Returns the value of #last_changed column or throw an exception if the column is not defined.


def last_changed=(x : Int64 | Nil) #

Setter for #last_changed column.


def last_changed_column : Clear::Model::Column(Int64 | Nil, Clear::Model::Converter::Int64Converter) #

Returns the column object used to manage #last_changed field

See Clear::Model::Column


def process_state : String | Nil #

Returns the value of #process_state column or throw an exception if the column is not defined.


def process_state=(x : String | Nil) #

Setter for #process_state column.


def process_state_column : Clear::Model::Column(String | Nil, Clear::Model::Converter::StringConverter) #

Returns the column object used to manage #process_state field

See Clear::Model::Column


def rejected : Bool #

Returns the value of #rejected column or throw an exception if the column is not defined.


def rejected=(x : Bool) #

Setter for #rejected column.


def rejected_at : Int64 | Nil #

Returns the value of #rejected_at column or throw an exception if the column is not defined.


def rejected_at=(x : Int64 | Nil) #

Setter for #rejected_at column.


def rejected_at_column : Clear::Model::Column(Int64 | Nil, Clear::Model::Converter::Int64Converter) #

Returns the column object used to manage #rejected_at field

See Clear::Model::Column


def rejected_column : Clear::Model::Column(Bool, Clear::Model::Converter::BoolConverter) #

Returns the column object used to manage #rejected field

See Clear::Model::Column


def reset(h : Hash(Symbol, _)) #

Set the columns from hash


def reset(h : Hash(String, _)) #

Set the model fields from hash


def reset(t : NamedTuple) #

def reset(from_json : JSON::Any) #

def reset(**t : **T) forall T #

reset flavors


def set(h : Hash(Symbol, _)) #

Set the columns from hash


def set(h : Hash(String, _)) #

Set the model fields from hash


def set(t : NamedTuple) #

def set(from_json : JSON::Any) #

def set(**t : **T) forall T #
Description copied from module Clear::Model::HasColumns

Set one or multiple columns to a specific value This two are equivalents:

model.set(a: 1)
model.a = 1

def set_created #

[View source]
def set_from_json(string_or_io : String | IO, trusted : Bool = false) #

Set the fields from json passed as argument Trusted flag set to true will allow mass assignment without protection, FALSE by default


def tenant : Tenant #

The method tenant is a belongs_to relation to Tenant


def tenant=(model : Tenant) #

def tenant_id : Int64 #

Returns the value of #tenant_id column or throw an exception if the column is not defined.


def tenant_id=(x : Int64) #

Setter for #tenant_id column.


def tenant_id_column : Clear::Model::Column(Int64, Clear::Model::Converter::Int64Converter) #

Returns the column object used to manage #tenant_id field

See Clear::Model::Column


def timezone : String | Nil #

Returns the value of #timezone column or throw an exception if the column is not defined.


def timezone=(x : String | Nil) #

Setter for #timezone column.


def timezone_column : Clear::Model::Column(String | Nil, Clear::Model::Converter::StringConverter) #

Returns the column object used to manage #timezone field

See Clear::Model::Column


def title : String | Nil #

Returns the value of #title column or throw an exception if the column is not defined.


def title=(x : String | Nil) #

Setter for #title column.


def title_column : Clear::Model::Column(String | Nil, Clear::Model::Converter::StringConverter) #

Returns the column object used to manage #title field

See Clear::Model::Column


def to_h(full = false) : Hash(String, Clear::SQL::Any) #

Return a hash version of the columns of this model.


def to_json(emit_nulls : Bool = false) #

def to_json(json : JSON::Builder, emit_nulls = false) #

def update_from_json(string_or_io : String | IO, trusted : Bool = false) #

Set the fields from json passed as argument and call save on the object Trusted flag set to true will allow mass assignment without protection, FALSE by default


def update_from_json!(string_or_io : String | IO, trusted : Bool = false) #

Set the fields from json passed as argument and call save! on the object Trusted flag set to true will allow mass assignment without protection, FALSE by default


def update_h : Hash(String, Clear::SQL::Any) #

Generate the hash for update request (like during save)


def user_email : String #

Returns the value of #user_email column or throw an exception if the column is not defined.


def user_email=(x : String) #

Setter for #user_email column.


def user_email_column : Clear::Model::Column(String, Clear::Model::Converter::StringConverter) #

Returns the column object used to manage #user_email field

See Clear::Model::Column


def user_id : String #

Returns the value of #user_id column or throw an exception if the column is not defined.


def user_id=(x : String) #

Setter for #user_id column.


def user_id_column : Clear::Model::Column(String, Clear::Model::Converter::StringConverter) #

Returns the column object used to manage #user_id field

See Clear::Model::Column


def user_name : String #

Returns the value of #user_name column or throw an exception if the column is not defined.


def user_name=(x : String) #

Setter for #user_name column.


def user_name_column : Clear::Model::Column(String, Clear::Model::Converter::StringConverter) #

Returns the column object used to manage #user_name field

See Clear::Model::Column


def validate #
Description copied from module Clear::Model::HasValidation

This method is called whenever valid? or save is called. By default, #validate is empty and must be overriden by your own validation code.


[View source]
def validate_fields_presence #

For each column, ensure than when needed the column has present information into it.

This method is called on validation.


def zones : Array(String) | Nil #

Returns the value of #zones column or throw an exception if the column is not defined.


def zones=(x : Array(String) | Nil) #

Setter for #zones column.


def zones_column : Clear::Model::Column(Array(String) | Nil, Clear::Model::Converter::ArrayConverterString) #

Returns the column object used to manage #zones field

See Clear::Model::Column