aboutsummaryrefslogblamecommitdiffstats
path: root/activerecord/lib/active_record/serializers/json_serializer.rb
blob: 63bf42c09d3e32f85bae6f3d9a3f918a727a5b77 (plain) (tree)
1
2
3
4
5
6
7
8
9

                            
                                 
                                          
 

                                                                     

       
                            
                                                    
       

     
module ActiveRecord #:nodoc:
  module Serialization
    extend ActiveSupport::Concern
    include ActiveModel::Serializers::JSON

    class JSONSerializer < ActiveModel::Serializers::JSON::Serializer
      include Serialization::RecordSerializer
    end

    def encode_json(encoder)
      JSONSerializer.new(self, encoder.options).to_s
    end
  end
end