Sha256: 289be6b669ad82db9613eab2d675fef3bc7ba02b43a8ad03d26ec12a243aa1f9
Contents?: true
Size: 969 Bytes
Versions: 3
Compression:
Stored size: 969 Bytes
Contents
# frozen_string_literal: true module ActiveModel class Serializer class Association class HasMany < Association def initialize(name, *args) super @root_key = @embedded_key.to_s @key ||= case CONFIG.default_key_type when :name then name.to_s.pluralize else "#{name.to_s.singularize}_ids" end end def serializer_class(object, _) if use_array_serializer? ArraySerializer else serializer_from_options end end def options if use_array_serializer? { each_serializer: serializer_from_options }.merge! super else super end end private def use_array_serializer? !serializer_from_options || serializer_from_options && !(serializer_from_options <= ArraySerializer) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems