Sha256: e6f053a221bfeb41c007ecd56e675892b29839bc70d5f84cbc814b9dbe2af9e4

Contents?: true

Size: 400 Bytes

Versions: 1

Compression:

Stored size: 400 Bytes

Contents

# frozen_string_literal: true

class AssociationSerializer < ApplicationSerializer
  attr_reader :association

  def initialize(association)
    @association = association
  end

  def to_h
    {
      name: association_name,
      macro: association.macro,
      model: association.class_name || association_name.classify
    }
  end

  private

  delegate :name, to: :association, prefix: true
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
model_explorer-0.1.0 app/serializers/association_serializer.rb