Sha256: c0874b79bbc853c5b76a817d1672aafc304ea1b09c813e3728580467238f1efb

Contents?: true

Size: 411 Bytes

Versions: 19

Compression:

Stored size: 411 Bytes

Contents

module Spina::Api
  class ResourceSerializer < BaseSerializer
    set_type :resource
    
    attributes :name, :label, :view_template, :order_by, :slug
    
    has_many :pages, lazy_load_data: true, links: {
      self: -> (object) { api_resource_path(object.id) },
      related: -> (object) { api_resource_pages_path(object.id) }
    }, meta: -> (resource) { {count: resource.pages.live.length} }
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
spina-2.12.0 app/serializers/spina/api/resource_serializer.rb
spina-2.11.0 app/serializers/spina/api/resource_serializer.rb
spina-2.10.0 app/serializers/spina/api/resource_serializer.rb
spina-2.9.1 app/serializers/spina/api/resource_serializer.rb
spina-2.9.0 app/serializers/spina/api/resource_serializer.rb
spina-2.8.1 app/serializers/spina/api/resource_serializer.rb
spina-2.8.0 app/serializers/spina/api/resource_serializer.rb
spina-2.7.0 app/serializers/spina/api/resource_serializer.rb
spina-2.6.2 app/serializers/spina/api/resource_serializer.rb
spina-2.6.1 app/serializers/spina/api/resource_serializer.rb
spina-2.6.0 app/serializers/spina/api/resource_serializer.rb
spina-2.5.0 app/serializers/spina/api/resource_serializer.rb
spina-2.4.0 app/serializers/spina/api/resource_serializer.rb
spina-2.3.5 app/serializers/spina/api/resource_serializer.rb
spina-2.3.4 app/serializers/spina/api/resource_serializer.rb
spina-2.3.3 app/serializers/spina/api/resource_serializer.rb
spina-2.3.2 app/serializers/spina/api/resource_serializer.rb
spina-2.3.1 app/serializers/spina/api/resource_serializer.rb
spina-2.3.0 app/serializers/spina/api/resource_serializer.rb