class Card

Included Modules

Defined in:

models/card.cr

Constant Summary

ASSOCIATIONS = [{type: Deck, assoc_name: deck, foreign_key: :deck_id, relationship_type: :belongs_to, through: nil}] of Nil
COLUMNS = [{name: id, type: Int64, nilable: false, autogenerated: true, value: nil, serialized: false, allow_blank: false}, {name: created_at, type: Time, nilable: false, autogenerated: true, value: nil, serialized: false, allow_blank: false}, {name: updated_at, type: Time, nilable: false, autogenerated: true, value: nil, serialized: false, allow_blank: false}, {name: deck_id, type: Deck::PrimaryKeyType, nilable: false, autogenerated: false, value: nil, serialized: false, allow_blank: false}, {name: card_type, type: Card::Type, nilable: false, autogenerated: false, value: nil, serialized: false, allow_blank: false}, {name: content, type: Card::Content, nilable: false, autogenerated: false, value: nil, serialized: true, allow_blank: false}, {name: last_review_at, type: Time, nilable: true, autogenerated: false, value: nil, serialized: false, allow_blank: false}] of Nil
PRIMARY_KEY_NAME = :id
PRIMARY_KEY_TYPE = Int64

Constructors

Class Method Summary

Instance Method Summary

Class methods inherited from class BaseModel

database : Avram::Database.class database

Constructor Detail

def self.new(id : Int64, created_at : Time, updated_at : Time, deck_id : Int64, card_type : Int32 | Int64, content : Card::Content, last_review_at : Time | Nil) #

def self.new(__temp_131 : DB::ResultSet) #

Class Method Detail

def self.column_names : Array(Symbol) #

def self.columns : Array(NamedTuple(name: Symbol, nilable: Bool, type: String)) #

def self.ensure_correct_column_mappings! #

def self.from_rs(__temp_131 : DB::ResultSet) #

def self.primary_key_name : Symbol | Nil #

def self.schema_enforcer_validations #

def self.table_name : String #

Instance Method Detail

def base_query_class : ::Card::BaseQuery.class #

This makes it easy for plugins and extensions to use the base SaveOperation


def card_type : Card::Type #

def card_type=(_card_type : Card::Type::Lucky::ColumnType) #

def content : Card::Content #

def content=(_content : Card::Content) #

def created_at : Time #

def created_at=(_created_at : Time::Lucky::ColumnType) #

def deck : Deck #

def deck! : Deck #

def deck_count : Int64 #

def deck_id : Deck::PrimaryKeyType #

def deck_id=(_deck_id : Deck::PrimaryKeyType::Lucky::ColumnType) #

def deck_preloaded? : Bool #

Returns true if the association has been preloaded


def deck_query #

def delete_operation_class : ::Card::DeleteOperation.class #

def id : Int64 #

def id=(_id : Int64::Lucky::ColumnType) #

def last_review_at : Time | Nil #

def last_review_at=(_last_review_at : Time::Lucky::ColumnType | Nil) #

def save_operation_class : ::Card::SaveOperation.class #

def updated_at : Time #

def updated_at=(_updated_at : Time::Lucky::ColumnType) #