module PolyBelongsTo::Pbt

PolyBelongsTo::Pbt is where internal methods are for implementing core and duplication methods; available on all instances. They are available for other use if the need should arise.

Constants

AsCollectionProxy

Returns either a ActiveRecord::CollectionProxy or a PolyBelongsTo::FakedCollection as a proxy @param obj [Object] ActiveRecord instance @param child [Object] ActiveRecord instance or model class @return [Object]

AttrSanitizer

Strips date and id fields dup'd attributes @param obj [Object] ActiveRecord instance that has attributes @return [Hash] attributes

BuildCmd

Discerns which type of build command is used between obj and child @param obj [Object] ActiveRecord instance to build on @param child [Object] ActiveRecord child relation as class or instance @return [String, nil] build command for relation, or nil

CollectionProxy

Returns the symbol of the child relation object @param obj [Object] ActiveRecord instance @param child [Object] ActiveRecord instance or model class @return [Symbol] working relation on obj

IsPlural

Plurality of object relationship (for has_many) @param obj [Object] ActiveRecord instance @param child [Object] ActiveRecord instance or model class @return [true, false]

IsReflected

Check if the child object is a kind of child that belongs to obj @param obj [Object] ActiveRecord instance @param child [Object] ActiveRecord instance or model class @return [true, false]

IsSingular

Singularity of object relationship (for has_one) @param obj [Object] ActiveRecord instance @param child [Object] ActiveRecord instance or model class @return [true, false]

Reflects

Returns all has_one and has_many relationships as symbols (reflect_on_all_associations) @param obj [Object] ActiveRecord instance to reflect on @param habtm [Object] optional boolean argument to include has_and_belongs_to_many @return [Array<Symbol>]

ReflectsAsClasses

Returns all has_one and has_many relationships as class objects (reflect_on_all_associations) @param obj [Object] ActiveRecord instance to reflect on @param habtm [Object] optional boolean argument to include has_and_belongs_to_many @return [Array<Object>]

SingularOrPlural

Plurality of object relationship (plural for has_many) @param obj [Object] ActiveRecord instance @param child [Object] ActiveRecord instance or model class @return [Symbol, nil] :plural, :singular, or nil