Class: Decidim::DecidimAwesome::Proposals::PrivateProposalSerializer
- Inherits:
-
Proposals::ProposalSerializer
- Object
- Proposals::ProposalSerializer
- Decidim::DecidimAwesome::Proposals::PrivateProposalSerializer
- Includes:
- ProposalSerializerMethods
- Defined in:
- app/serializers/decidim/decidim_awesome/proposals/private_proposal_serializer.rb
Overview
Custom serializer for Proposals with private data. Used to separate open-data export and admin export.
Instance Method Summary collapse
Instance Method Details
#serialize ⇒ Object
12 13 14 15 |
# File 'app/serializers/decidim/decidim_awesome/proposals/private_proposal_serializer.rb', line 12 def serialize serialization = super.merge!(serialize_private_custom_fields) serialization.merge!(serialize_private_notes) end |
#serialize_private_notes ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/serializers/decidim/decidim_awesome/proposals/private_proposal_serializer.rb', line 17 def serialize_private_notes payload = {} notes = proposal.notes return payload unless notes.any? notes.each do |note| payload["notes/#{note.id}".to_sym] = { created_at: note.created_at, note: note.body, author: (note.) } end payload end |