v6.1.3.1 - Show latest stable - 0 notes - Superclass: Object

Base class for serializing and deserializing custom objects.

Example:

class MoneySerializer < ActiveJob::Serializers::ObjectSerializer
  def serialize(money)
    super("amount" => money.amount, "currency" => money.currency)
  end

  def deserialize(hash)
    Money.new(hash["amount"], hash["currency"])
  end

  private

    def klass
      Money
    end
end
Show files where this class is defined (1 file)
Register or log in to add new notes.