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

Returns the value of attribute links

Returns:

  • (Object)

    the current value of links



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

def links
  @links
end

#metaObject

Returns the value of attribute meta

Returns:

  • (Object)

    the current value of meta



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

def meta
  @meta
end

#nameSymbol

Returns the current value of name.

Returns:

  • (Symbol)

    the current value of name



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

def name
  @name
end

#optionsHash{Symbol => Object}

Returns the current value of options.

Returns:

  • (Hash{Symbol => Object})

    the current value of options



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

def options
  @options
end

#serializerActiveModel::Serializer

Returns the current value of serializer.

Returns:



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

def serializer
  @serializer
end

Instance Method Details

#keySymbol

Returns:

  • (Symbol)


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

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