Sha256: 87ded2eddaf2fcac79a6fffa4eb0b63953ec0ba4be9516824c96ee18faabc4ce

Contents?: true

Size: 420 Bytes

Versions: 6

Compression:

Stored size: 420 Bytes

Contents

class PageSerializer < ActiveModel::Serializer
  attributes :id, :param, :parent_page_id, :locale
  attributes(*PagesCore::Templates::TemplateConfiguration.all_blocks)
  attributes :published_at, :pinned

  has_one :image
  has_many :images
  has_many :pages

  def param
    object.to_param
  end

  def image
    object.page_images.where(primary: true).try(:first)
  end

  def images
    object.page_images
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pages_core-3.6.2 app/serializers/page_serializer.rb
pages_core-3.6.1 app/serializers/page_serializer.rb
pages_core-3.6.0 app/serializers/page_serializer.rb
pages_core-3.4.3 app/serializers/page_serializer.rb
pages_core-3.5.1 app/serializers/page_serializer.rb
pages_core-3.4.2 app/serializers/page_serializer.rb