mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
8896b4fdc8
The following constants were renamed: ActiveModel::Serialization => ActiveModel::Serializable ActiveModel::Serializers::JSON => ActiveModel::Serializable::JSON ActiveModel::Serializers::Xml => ActiveModel::Serializable::XML The main motivation for such a change is that `ActiveModel::Serializers::JSON` was not actually a serializer, but a module that when included allows the target to be serializable to JSON. With such changes, we were able to clean up the namespace to add true serializers as the ArraySerializer.
18 lines
482 B
Ruby
18 lines
482 B
Ruby
module ActiveRecord #:nodoc:
|
|
# = Active Record Serialization
|
|
module Serialization
|
|
extend ActiveSupport::Concern
|
|
include ActiveModel::Serializable::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'
|