Sha256: a926d88f257f2a66deb6666a587d321a7eba4f9e7f7860dd35d29ccc9e72ce6b
Contents?: true
Size: 724 Bytes
Versions: 3
Compression:
Stored size: 724 Bytes
Contents
# frozen_string_literal: true module ActiveModel class Serializer class Association class HasOne < Association def initialize(name, *args) super @root_key = @embedded_key.to_s.pluralize @key ||= case CONFIG.default_key_type when :name then name.to_s.singularize else "#{name}_id" end end def serializer_class(object, options = {}) (serializer_from_options unless object.nil?) || serializer_from_object(object, options) || default_serializer end def build_serializer(object, options = {}) options[:_wrap_in_array] = embed_in_root? super end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems