Module: ActiveEntity::Serialization

Extended by:
ActiveSupport::Concern
Includes:
ActiveModel::Serializers::JSON
Included in:
Base
Defined in:
lib/active_entity/serialization.rb

Overview

Active Entity Serialization

Instance Method Summary collapse

Instance Method Details

#serializable_hash(options = nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/active_entity/serialization.rb', line 13

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

  include_embeds = options.delete :include_embeds
  if include_embeds
    includes = Array.wrap(options[:include]).concat(self.class.embeds_association_names)
    options[:include] ||= []
    options[:include].concat includes
  end

  options[:except] = Array(options[:except]).map(&:to_s)

  super(options)
end