Sha256: dc3b572be5b63b7c9f431ebae7750f20f9b6f2b48e58755b3209119837dafaae

Contents?: true

Size: 556 Bytes

Versions: 24

Compression:

Stored size: 556 Bytes

Contents

# encoding: utf-8
module Mongoid
  module Persistence
    module Atomic

      # Performs atomic $unset operations.
      class Unset
        include Operation

        # Sends the atomic $unset operation to the database.
        #
        # @example Persist the new values.
        #   unset.persist
        #
        # @return [ nil ] The new value.
        #
        # @since 2.1.0
        def persist
          prepare do
            document.attributes.delete(field)
            execute("$unset")
          end
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
mongoid-3.0.23 lib/mongoid/persistence/atomic/unset.rb
mongoid-3.0.22 lib/mongoid/persistence/atomic/unset.rb
mongoid-3.0.21 lib/mongoid/persistence/atomic/unset.rb
mongoid-3.0.20 lib/mongoid/persistence/atomic/unset.rb
mongoid-3.0.19 lib/mongoid/persistence/atomic/unset.rb
mongoid-3.0.18 lib/mongoid/persistence/atomic/unset.rb
mongoid-3.0.17 lib/mongoid/persistence/atomic/unset.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.16/lib/mongoid/persistence/atomic/unset.rb
mongoid-3.0.16 lib/mongoid/persistence/atomic/unset.rb
mongoid-3.0.15 lib/mongoid/persistence/atomic/unset.rb
mongoid-3.0.14 lib/mongoid/persistence/atomic/unset.rb
mongoid-3.0.13 lib/mongoid/persistence/atomic/unset.rb
mongoid-3.0.12 lib/mongoid/persistence/atomic/unset.rb
mongoid-3.0.11 lib/mongoid/persistence/atomic/unset.rb
mongoid-3.0.10 lib/mongoid/persistence/atomic/unset.rb
mongoid-3.0.9 lib/mongoid/persistence/atomic/unset.rb
mongoid-3.0.6 lib/mongoid/persistence/atomic/unset.rb
mongoid-3.0.5 lib/mongoid/persistence/atomic/unset.rb
mongoid-3.0.4 lib/mongoid/persistence/atomic/unset.rb
mongoid-3.0.3 lib/mongoid/persistence/atomic/unset.rb