123456789_123456789_123456789_123456789_123456789_

Module: ActiveRecord::Serialization

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Base, ActiveRecord::InternalMetadata, ActiveRecord::SchemaMigration
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Defined in: activerecord/lib/active_record/serialization.rb

::ActiveModel::Serializers::JSON - Attributes & Methods

Class Method Summary

::ActiveModel::Naming - self

param_key

Returns string to use for params names.

plural

Returns the plural class name of a record or class.

route_key

Returns string to use while generating route names.

singular

Returns the singular class name of a record or class.

singular_route_key

Returns string to use while generating route names.

uncountable?

Identifies whether the class name of a record or class is uncountable.

::ActiveSupport::Concern - Extended

Instance Method Summary

::ActiveModel::Serializers::JSON - Included

#as_json

Returns a hash representing the model.

#from_json

Sets the model attributes from a JSON string.

::ActiveModel::Serialization - Included

#serializable_hash

Returns a serialized hash of your object.

DSL Calls

included

[ GitHub ]


9
10
11
# File 'activerecord/lib/active_record/serialization.rb', line 9

included do
  self.include_root_in_json = false
end

Class Attribute Details

.include_root_in_json (rw)

[ GitHub ]

  
# File 'activemodel/lib/active_model/serializers/json.rb', line 15

class_attribute :include_root_in_json, instance_writer: false, default: false

.include_root_in_json?Boolean (rw)

[ GitHub ]

  
# File 'activemodel/lib/active_model/serializers/json.rb', line 15

class_attribute :include_root_in_json, instance_writer: false, default: false

Instance Attribute Details

#include_root_in_json (readonly)

[ GitHub ]

  
# File 'activemodel/lib/active_model/serializers/json.rb', line 15

class_attribute :include_root_in_json, instance_writer: false, default: false

#include_root_in_json?Boolean (readonly)

[ GitHub ]

  
# File 'activemodel/lib/active_model/serializers/json.rb', line 15

class_attribute :include_root_in_json, instance_writer: false, default: false

Instance Method Details

#serializable_hash(options = nil)

[ GitHub ]

  
# File 'activerecord/lib/active_record/serialization.rb', line 13

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

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

  super(options)
end