Sha256: 26cd59459f15996100e27e4444bf948453491f4a410586be2dcfbf2fe1486e01

Contents?: true

Size: 614 Bytes

Versions: 1

Compression:

Stored size: 614 Bytes

Contents

module DataMapper
  module NestedAttributes

    module TransactionalSave

      ##
      # Overrides @see DataMapper::Resource#save to perform inside a transaction.
      # The current implementation simply wraps the saving of the complete object tree
      # inside a transaction and rolls back in case any exceptions are raised,
      # or any of the calls to
      #
      # @see DataMapper::Resource#save
      #
      # @return [Boolean]
      #   true if all related resources were saved properly
      #
      def save
        transaction { |t| super || t.rollback && false }
      end

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dm-accepts_nested_attributes-0.12.0 lib/dm-accepts_nested_attributes/transactional_save.rb