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

                                        
                                         



                                                                        
                    
       



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

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

      options[:except] = Array.wrap(options[:except]).map { |n| n.to_s }
      options[:except] |= Array.wrap(self.class.inheritance_column)

      super(options)
    end
  end
end

require 'active_record/serializers/xml_serializer'