Module: ActiveModel::Serializable
- Included in:
- ArraySerializer, Serializer
- Defined in:
- lib/active_model/serializable.rb
Overview
Enable classes to Classes including this module to serialize themselves by implementing a serialize method and an options method.
Example:
require 'active_model_serializers'
class MySerializer
include ActiveModel::Serializable
def initialize
@options = {}
end
attr_reader :options
def serialize
{ a: 1 }
end
end
puts MySerializer.new.to_json