Class: Decidim::Comments::CommentSerializer
- Inherits:
-
Exporters::Serializer
- Object
- Exporters::Serializer
- Decidim::Comments::CommentSerializer
- Includes:
- ResourceHelper, TranslationsHelper
- Defined in:
- lib/decidim/comments/comment_serializer.rb
Instance Method Summary collapse
-
#serialize ⇒ Object
Serializes a comment.
Instance Method Details
#serialize ⇒ Object
Serializes a comment
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/decidim/comments/comment_serializer.rb', line 10 def serialize { id: resource.id, created_at: resource.created_at, body: resource.body.values.first, locale: resource.body.keys.first, author: { id: resource..id, name: resource..name }, alignment: resource.alignment, depth: resource.depth, user_group: { id: resource.user_group.try(:id), name: resource.user_group.try(:name) || empty_translatable }, commentable_id: resource.decidim_commentable_id, commentable_type: resource.decidim_commentable_type, root_commentable_url: root_commentable_url } end |