module Gecko::Helpers::AssociationHelper

Helper for has_many/belongs_to relationships

Public Class Methods

included(base) click to toggle source
# File lib/gecko/helpers/association_helper.rb, line 9
def self.included(base)
  base.extend(ClassMethods)
end

Private Instance Methods

build_collection_proxy(target, association_name:, class_name:, embedded:) click to toggle source

Setup a child collection proxy on first instantation

@return [Hash]

@api private

# File lib/gecko/helpers/association_helper.rb, line 104
def build_collection_proxy(target, association_name:, class_name:, embedded:)
  CollectionProxy.new(**{
    parent:           self,
    target:           target,
    embedded:         embedded,
    class_name:       class_name,
    association_name: association_name
  })
end
collection_proxies() click to toggle source

Stores a reference to all of the child collection proxies on the model

@return [Hash]

@api private

# File lib/gecko/helpers/association_helper.rb, line 95
def collection_proxies
  @collection_proxies ||= {}
end