Sha256: 281bd28117926134c2a8543149bf68708f1a53b81733375e835fe191f8ab3a13

Contents?: true

Size: 748 Bytes

Versions: 5

Compression:

Stored size: 748 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

5 entries across 5 versions & 1 rubygems

Version Path
landable-1.13.1 app/serializers/landable/page_serializer.rb
landable-1.12.3 app/serializers/landable/page_serializer.rb
landable-1.12.2 app/serializers/landable/page_serializer.rb
landable-1.12.1 app/serializers/landable/page_serializer.rb
landable-1.11.1 app/serializers/landable/page_serializer.rb