Class: Decidim::Pages::DataSerializer

Inherits:
Exporters::Serializer
  • Object
show all
Includes:
TranslationsHelper
Defined in:
app/serializers/decidim/pages/data_serializer.rb

Overview

This class serializes the specific data in each Page. This is the page data outside of the component settings.

Instance Method Summary collapse

Instance Method Details

#serializeHash

Serializes the page data for this component.

Returns:

  • (Hash)

    The serialized data



13
14
15
16
17
18
19
# File 'app/serializers/decidim/pages/data_serializer.rb', line 13

def serialize
  page = Page.find_by(component: resource)

  {
    body: page&.body || empty_translatable
  }
end