active_model_serializers/lib/active_model/serializer/association.rb
2015-08-31 01:26:22 +02:00

22 lines
496 B
Ruby

module ActiveModel
class Serializer
# This class hold all information about serializer's association.
#
# @param [Symbol] name
# @param [ActiveModel::Serializer] serializer
# @param [Hash{Symbol => Object}] options
#
# @example
# Association.new(:comments, CommentSummarySerializer)
#
Association = Struct.new(:name, :serializer, :options) do
# @return [Symbol]
#
def key
options.fetch(:key, name)
end
end
end
end