Class: ActiveModel::Serializer::Association

Inherits:
Struct
  • Object
show all
Defined in:
lib/active_model/serializer/association.rb

Overview

This class hold all information about serializer’s association.

Examples:

Association.new(:comments, CommentSummarySerializer)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



12
13
14
# File 'lib/active_model/serializer/association.rb', line 12

def name
  @name
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



12
13
14
# File 'lib/active_model/serializer/association.rb', line 12

def options
  @options
end

#serializerObject

Returns the value of attribute serializer

Returns:

  • (Object)

    the current value of serializer



12
13
14
# File 'lib/active_model/serializer/association.rb', line 12

def serializer
  @serializer
end

Instance Method Details

#keySymbol

Returns:

  • (Symbol)


15
16
17
# File 'lib/active_model/serializer/association.rb', line 15

def key
  options.fetch(:key, name)
end