1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/lib/active_record/serialization.rb
2012-10-31 00:08:36 +09:00

22 lines
535 B
Ruby

module ActiveRecord #:nodoc:
# = Active Record Serialization
module Serialization
extend ActiveSupport::Concern
include ActiveModel::Serializers::JSON
included do
self.include_root_in_json = true
end
def serializable_hash(options = nil)
options = options.try(:clone) || {}
options[:except] = Array(options[:except]).map { |n| n.to_s }
options[:except] |= Array(self.class.inheritance_column)
super(options)
end
end
end
require 'active_record/serializers/xml_serializer'