aboutsummaryrefslogblamecommitdiffstats
path: root/activerecord/lib/active_record/serialization.rb
blob: 48c12dcf9fdaceb88ec40b2eed6ca3d5927521a5 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                            
                                 
                      
                                 
                                          
 
               
                                       

       
                                        
                                         
 
                                                            
                                                              
 
                    
       



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

    included do
      self.include_root_in_json = false
    end

    def serializable_hash(options = nil)
      options = options.try(:clone) || {}

      options[:except] = Array(options[:except]).map(&:to_s)
      options[:except] |= Array(self.class.inheritance_column)

      super(options)
    end
  end
end

require 'active_record/serializers/xml_serializer'