Sha256: 44a5bc1796bd30e280e473b2e08362f18c76f00eac3764850d4a4d89cb4e4413

Contents?: true

Size: 643 Bytes

Versions: 2

Compression:

Stored size: 643 Bytes

Contents

module Landable
  class PageSerializer < ActiveModel::Serializer

    attributes :abstract, :body, :deleted_at, :head_content, :hero_asset_name, 
               :id, :is_publishable, :lock_version, :meta_tags, :path, 
               :preview_path, :redirect_url, :status_code, :title

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