Class: Ivy::Serializers::Documents::ResourceCollection

Inherits:
Document
  • Object
show all
Defined in:
lib/ivy/serializers/documents/resource_collection.rb

Instance Method Summary collapse

Methods inherited from Document

#belongs_to, #generate, #generate_attributes, #generate_included_resources, #generate_relationships, #generate_resource, #has_many, #initialize

Constructor Details

This class inherits a constructor from Ivy::Serializers::Documents::Document

Instance Method Details

#generate_included(generator) ⇒ Object



7
8
9
10
# File 'lib/ivy/serializers/documents/resource_collection.rb', line 7

def generate_included(generator)
  @primary_resource.each { |resource| @serializer.relationships(self, resource) }
  super
end

#generate_primary_resource(generator) ⇒ Object



12
13
14
# File 'lib/ivy/serializers/documents/resource_collection.rb', line 12

def generate_primary_resource(generator)
  generator.primary_resources(@primary_resource_name, @primary_resource)
end