Module: Mongoid::Serialization
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveModel::Serialization
- Included in:
- Components
- Defined in:
- lib/mongoid/serialization.rb
Overview
This module provides the extra behaviour for including relations in JSON and XML serialization.
Instance Method Summary collapse
-
#serializable_hash(options = nil) ⇒ Hash
Gets the document as a serializable hash, used by ActiveModel’s JSON and XML serializers.
Instance Method Details
#serializable_hash(options = nil) ⇒ Hash
Gets the document as a serializable hash, used by ActiveModel’s JSON and XML serializers. This override is just to be able to pass the :include and :except options to get associations in the hash.
29 30 31 32 33 34 |
# File 'lib/mongoid/serialization.rb', line 29 def serializable_hash( = nil) ||= {} super().tap do |attrs| serialize_relations(attrs, ) if [:include] end end |