Sha256: 89ebb90fed633d423e9f8f188d9ff8f01bbac4f54797dd6ddd26689eca5a8263

Contents?: true

Size: 505 Bytes

Versions: 27

Compression:

Stored size: 505 Bytes

Contents

module Alchemy
  class PageSerializer < ActiveModel::Serializer
    self.root = false

    attributes :id,
      :name,
      :urlname,
      :page_layout,
      :title,
      :language_code,
      :meta_keywords,
      :meta_description,
      :tag_list,
      :created_at,
      :updated_at,
      :status

    has_many :elements, :cells

    def elements
      if object.has_cells?
        object.elements.not_in_cell.published
      else
        object.elements.published
      end
    end

  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
alchemy_cms-3.0.2 app/serializers/alchemy/page_serializer.rb
alchemy_cms-3.0.1 app/serializers/alchemy/page_serializer.rb
alchemy_cms-3.0.0 app/serializers/alchemy/page_serializer.rb
alchemy_cms-3.0.0.rc8 app/serializers/alchemy/page_serializer.rb
alchemy_cms-3.0.0.rc7 app/serializers/alchemy/page_serializer.rb
alchemy_cms-3.0.0.rc6 app/serializers/alchemy/page_serializer.rb
alchemy_cms-3.0.0.rc5 app/serializers/alchemy/page_serializer.rb