Sha256: 4416c6196dcdc7c27ae8cc4424533da39688e5185cbf4178248e750d4bfe0b8f

Contents?: true

Size: 765 Bytes

Versions: 2

Compression:

Stored size: 765 Bytes

Contents

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

    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.7.1.rc1 app/serializers/landable/page_serializer.rb
landable-1.7.0 app/serializers/landable/page_serializer.rb