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
Yves Senn 8c7d4018e0 ActiveRecord::Base.include_root_in_json is false by default.
Closes #9459.

The PR #6597 unified the configuration for `include_root_in_json`
in AM and AR to `false`.
Later on with the refactoring commit: e030f26 the value in AR was
set to `true` but I think this was not on purpose.

With this commit both AM and AR will have the same configuration
for `include_root_in_json`, which is `false`.
2013-03-04 21:18:40 +01:00

22 lines
536 B
Ruby

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 { |n| n.to_s }
options[:except] |= Array(self.class.inheritance_column)
super(options)
end
end
end
require 'active_record/serializers/xml_serializer'