Sha256: d6ea0f26e4e414fc9c81dc062ba7e05f38d88db318492688467673a247743b6c

Contents?: true

Size: 685 Bytes

Versions: 70

Compression:

Stored size: 685 Bytes

Contents

# frozen_string_literal: true

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)
      if self.class._has_attribute?(self.class.inheritance_column)
        options = options ? options.dup : {}

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

      super(options)
    end

    private
      def attribute_names_for_serialization
        attribute_names
      end
  end
end

Version data entries

70 entries across 69 versions & 9 rubygems

Version Path
omg-activerecord-8.0.0.alpha8 lib/active_record/serialization.rb
omg-activerecord-8.0.0.alpha7 lib/active_record/serialization.rb
omg-activerecord-8.0.0.alpha4 lib/active_record/serialization.rb
omg-activerecord-8.0.0.alpha3 lib/active_record/serialization.rb
omg-activerecord-8.0.0.alpha2 lib/active_record/serialization.rb
omg-activerecord-8.0.0.alpha1 lib/active_record/serialization.rb
activerecord-7.1.4 lib/active_record/serialization.rb
activerecord-7.2.1 lib/active_record/serialization.rb
activerecord-7.2.0 lib/active_record/serialization.rb
activerecord-7.2.0.rc1 lib/active_record/serialization.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8.4/lib/active_record/serialization.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.3.4/lib/active_record/serialization.rb
activerecord-7.2.0.beta3 lib/active_record/serialization.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.5.1/lib/active_record/serialization.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.5.1/lib/active_record/serialization.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.5.1/lib/active_record/serialization.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.3.4/lib/active_record/serialization.rb
activerecord-7.2.0.beta2 lib/active_record/serialization.rb
activerecord-7.1.3.4 lib/active_record/serialization.rb
activerecord-7.0.8.4 lib/active_record/serialization.rb