Sha256: a052632bb82155b3c39e4b990fa02cf9d07b6190c23e68f806f4a74035e2f596

Contents?: true

Size: 741 Bytes

Versions: 2

Compression:

Stored size: 741 Bytes

Contents

module Landable
  class PageSerializer < ActiveModel::Serializer
    attributes :id
    attributes :path, :title, :body
    attributes :head_content, :meta_tags
    attributes :status_code, :redirect_url
    attributes :is_publishable, :preview_path
    attributes :audit_flags, :page_name
    attributes :hero_asset_name, :abstract
    attributes :lock_version
    attributes :deleted_at

    embed :ids
    has_one :theme
    has_one :published_revision
    has_one :category
    has_one :updated_by_author, root: :authors, include: true, serializer: AuthorSerializer

    def category
      object.category || Landable::Category.where(name: 'Uncategorized').first
    end

    def meta_tags
      object.meta_tags || {}
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
landable-1.14.0 app/serializers/landable/page_serializer.rb
landable-1.13.2 app/serializers/landable/page_serializer.rb