abstract class Jennifer::Relation::IPolymorphicBelongsTo

Defined in:

jennifer/relation/polymorphic_belongs_to.cr

Constant Summary

DEFAULT_PRIMARY_FIELD = "id"

Constructors

Instance Method Summary

Macro Summary

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?, foreign_type : String | Symbol?) #

[View source]

Instance Method Detail

def build(opts : Hash, polymorphic_type) #

[View source]
def condition_clause(ids : Array(DBAny), polymorphic_type : String?) #

[View source]
def condition_clause(id : DBAny, polymorphic_type : String?) #

[View source]
def foreign : String #

[View source]
def foreign_field : String #

[View source]
def foreign_type : String #

[View source]
def insert(obj : Model::Base, rel : Hash) #

[View source]
def insert(obj : Model::Base, rel : Model::Base) #

[View source]
def join_condition(query, type) #

[View source]
def join_query #

[View source]
def model_class #

[View source]
def name : String #

[View source]
def preload_relation(collection, out_collection : Array(Jennifer::Model::Resource), pk_repo) #
Description copied from class Jennifer::Relation::IRelation

Preloads relation into collection from out_collection depending on keys from pk_repo.


[View source]
def primary : String #

[View source]
def primary_field : String #

[View source]
def query(id, polymorphic_type : Nil) #

[View source]
def query(id, polymorphic_type : String) #

[View source]
def query(a) #
Description copied from class Jennifer::Relation::IRelation

Returns query for given primary field values


[View source]
def remove(obj : Model::Base) #

[View source]
def table_name #

[View source]

Macro Detail

macro define_relation_class(name, klass, related_class, types, request) #

[View source]