module ActiveModel::Serializer::Associations::ClassMethods

def associate(reflection)

Other tags:
    Api: - private

Returns:
  • (void) -

Parameters:
  • reflection (ActiveModel::Serializer::Reflection) --
def associate(reflection)
  self._reflections << reflection
end

def belongs_to(name, options = {}, &block)

Returns:
  • (void) -

Parameters:
  • options (Hash any>) -- for the reflection
  • name (Symbol) -- of the association
def belongs_to(name, options = {}, &block)
  associate(BelongsToReflection.new(name, options, block))
end

def has_many(name, options = {}, &block)

Returns:
  • (void) -

Parameters:
  • options (Hash any>) -- for the reflection
  • name (Symbol) -- of the association
def has_many(name, options = {}, &block)
  associate(HasManyReflection.new(name, options, block))
end

def has_one(name, options = {}, &block)

Returns:
  • (void) -

Parameters:
  • options (Hash any>) -- for the reflection
  • name (Symbol) -- of the association
def has_one(name, options = {}, &block)
  associate(HasOneReflection.new(name, options, block))
end

def inherited(base)

def inherited(base)
  super
  base._reflections = _reflections.dup
end