Sha256: 3124f5d1ce5ada8d47f43861f985035e2f01e444a858be0fdd7e63dba7b708b5

Contents?: true

Size: 736 Bytes

Versions: 7

Compression:

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

7 entries across 7 versions & 1 rubygems

Version Path
landable-1.11.0 app/serializers/landable/page_serializer.rb
landable-1.10.0.rc2 app/serializers/landable/page_serializer.rb
landable-1.10.0.rc1 app/serializers/landable/page_serializer.rb
landable-1.9.2 app/serializers/landable/page_serializer.rb
landable-1.9.1 app/serializers/landable/page_serializer.rb
landable-1.9.0 app/serializers/landable/page_serializer.rb
landable-1.9.0.rc2 app/serializers/landable/page_serializer.rb