Sha256: 6b3da2b02fa0575a4449861945f0c8619b21cae5941fdd7ae67973d5bdfa788b

Contents?: true

Size: 443 Bytes

Versions: 31

Compression:

Stored size: 443 Bytes

Contents

module Mongoid #:nodoc:
  module Extensions #:nodoc:
    module Hash #:nodoc:
      module Accessors #:nodoc:
        def insert(key, attrs)
          self[key] = attrs if key.singular?
          if key.plural?
            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

31 entries across 31 versions & 1 rubygems

Version Path
mongoid-0.8.5 lib/mongoid/extensions/hash/accessors.rb
mongoid-0.8.4 lib/mongoid/extensions/hash/accessors.rb
mongoid-0.8.3 lib/mongoid/extensions/hash/accessors.rb
mongoid-0.8.2 lib/mongoid/extensions/hash/accessors.rb
mongoid-0.8.1 lib/mongoid/extensions/hash/accessors.rb
mongoid-0.7.10 lib/mongoid/extensions/hash/accessors.rb
mongoid-0.7.9 lib/mongoid/extensions/hash/accessors.rb
mongoid-0.7.8 lib/mongoid/extensions/hash/accessors.rb
mongoid-0.7.7 lib/mongoid/extensions/hash/accessors.rb
mongoid-0.7.6 lib/mongoid/extensions/hash/accessors.rb
mongoid-0.7.5 lib/mongoid/extensions/hash/accessors.rb
mongoid-0.7.4 lib/mongoid/extensions/hash/accessors.rb
mongoid-0.7.3 lib/mongoid/extensions/hash/accessors.rb
mongoid-0.7.2 lib/mongoid/extensions/hash/accessors.rb
mongoid-0.7.1 lib/mongoid/extensions/hash/accessors.rb
mongoid-0.7.0 lib/mongoid/extensions/hash/accessors.rb
mongoid-0.6.10 lib/mongoid/extensions/hash/accessors.rb
mongoid-0.6.9 lib/mongoid/extensions/hash/accessors.rb
mongoid-0.6.8 lib/mongoid/extensions/hash/accessors.rb
mongoid-0.6.7 lib/mongoid/extensions/hash/accessors.rb