def primary : String?
#
class Jennifer::Relation::Base(T, Q)
- Jennifer::Relation::Base(T, Q)
- Jennifer::Relation::IRelation
- Reference
- Object
Overview
Base generic relation class.
T - related model Q - parent model
Direct Known Subclasses
- Jennifer::Relation::BelongsTo(T, Q)
- Jennifer::Relation::HasMany(T, Q)
- Jennifer::Relation::HasOne(T, Q)
- Jennifer::Relation::ManyToMany(T, Q)
- Jennifer::Relation::PolymorphicHasMany(T, Q)
- Jennifer::Relation::PolymorphicHasOne(T, Q)
Defined in:
jennifer/relation/base.crConstructors
Instance Method Summary
- #adapter
- #condition_clause(ids : Array(DBAny))
- #condition_clause(id : DBAny)
- #condition_clause
- #foreign : String?
-
#foreign_field
Foreign key on T model side
- #insert(obj : Q, rel : Hash(String, T::AttrType))
- #insert(obj : Q, rel : Hash(Symbol, T::AttrType))
- #insert(obj : Q, rel : T)
- #join_condition(query, type)
- #join_query : QueryBuilder::Condition | QueryBuilder::LogicOperator | Nil
- #model_class
- #name : String
-
#preload_relation(collection, out_collection : Array(Model::Resource), pk_repo)
Preloads relation into collection from out_collection depending on keys from pk_repo.
- #primary : String?
- #primary_field
-
#query(primary_value_or_array)
Returns query for given primary field values
- #remove(obj : Q, rel : T)
- #table_name
- #through : Symbol?
Instance methods inherited from class Jennifer::Relation::IRelation
join_condition(a, b)
join_condition,
join_query
join_query,
model_class
model_class,
preload_relation(collection, out_collection : Array(Model::Resource), pk_repo)
preload_relation,
query(primary_value)
query,
table_name
table_name
Constructor Detail
def self.new(name, foreign : String | Symbol?, primary : String | Symbol?, query : QueryBuilder::Query, through = nil)
#
Instance Method Detail
def preload_relation(collection, out_collection : Array(Model::Resource), pk_repo)
#
Description copied from class Jennifer::Relation::IRelation
Preloads relation into collection from out_collection depending on keys from pk_repo.
def query(primary_value_or_array)
#
Description copied from class Jennifer::Relation::IRelation
Returns query for given primary field values