module AcceptsNestedSerializedAttributes::ActiveModel::Serialization

Public Instance Methods

original_serializable_hash(options = nil)
Alias for: serializable_hash
serializable_hash(options = nil) click to toggle source
# File lib/accepts_nested_serialized_attributes.rb, line 7
def serializable_hash(options = nil)
  original_serializable_hash(options).tap do |hash|
    hash.symbolize_keys!

    self.class.nested_attributes_options.keys.each do |nested_attributes_key|
      if (records = hash.delete nested_attributes_key)
        hash["#{nested_attributes_key}_attributes".to_sym] = records
      end
    end
  end
end
Also aliased as: original_serializable_hash