Sha256: 5f366319325559c74e1567508f537aae6bde65a4fd26b9f39875ab5419efadb1

Contents?: true

Size: 362 Bytes

Versions: 2

Compression:

Stored size: 362 Bytes

Contents

# frozen_string_literal: true

class Api::Admin::BaseSerializer < ActiveModel::Serializer
  def initialize(object, options = {})
    @type = options[:type]
    super(object, options)
  end

  def attributes(*args)
    field_custom = "Api::Admin::#{object.class}Serializer".constantize::FIELD_CUSTOM

    super.slice(*field_custom[@type] || super.keys)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
n_base_rails-0.1.2 lib/serializers/api/admin/base_serializer.rb
n_base_rails-0.1.1 lib/serializers/api/admin/base_serializer.rb