Class: SocialNetworking::Serializers::OnTheMindStatementSerializer

Inherits:
Serializer
  • Object
show all
Defined in:
app/models/social_networking/serializers/on_the_mind_statement_serializer.rb

Overview

Serializes OnTheMindStatement models.

Instance Attribute Summary

Attributes inherited from Serializer

#model

Instance Method Summary collapse

Methods inherited from Serializer

from_collection, #initialize

Constructor Details

This class inherits a constructor from SocialNetworking::Serializers::Serializer

Instance Method Details

#to_serializedObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/models/social_networking/serializers/on_the_mind_statement_serializer.rb', line 6

def to_serialized
  {
    className: "SocialNetworking::OnTheMindStatement",
    id: model.id,
    createdAt: model.created_at,
    createdAtRaw: model.created_at.to_i,
    participantId: model.participant_id,
    isAdmin: model.participant.is_admin,
    summary: "said #{model.description}",
    description: model.description,
    comments: CommentSerializer.from_collection(model.comments),
    likes: LikeSerializer.from_collection(model.likes)
  }
end