Sha256: 405df45019b7904678bcac4489a47edafabc5eeb7e6681f292b632330e26f7e5
Contents?: true
Size: 522 Bytes
Versions: 10
Compression:
Stored size: 522 Bytes
Contents
module Mongoid #:nodoc: module Extensions #:nodoc: module Hash #:nodoc: module Accessors #:nodoc: def insert(key, attrs) if key.singular? self[key] = attrs unless self[key] self[key] = self[key].merge(attrs) if self[key] else if elements = self[key] elements.delete_if { |e| (e[:_id] == attrs[:_id]) } << attrs else self[key] = [attrs] end end end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems