module ActiveModel::Serializer::Associations::ClassMethods
def associate(reflection)
- Api: - private
Returns:
-
(void)
-
Parameters:
-
reflection
(ActiveModel::Serializer::Reflection
) --
def associate(reflection) self._reflections << reflection end
def belongs_to(name, options = {}, &block)
-
(void)
-
Parameters:
-
options
(Hash
) -- for the reflectionany> -
name
(Symbol
) -- of the association
def belongs_to(name, options = {}, &block) associate(BelongsToReflection.new(name, options, block)) end
def has_many(name, options = {}, &block)
-
(void)
-
Parameters:
-
options
(Hash
) -- for the reflectionany> -
name
(Symbol
) -- of the association
def has_many(name, options = {}, &block) associate(HasManyReflection.new(name, options, block)) end
def has_one(name, options = {}, &block)
-
(void)
-
Parameters:
-
options
(Hash
) -- for the reflectionany> -
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