Sha256: ece5392df215caef714d5115f414f60d7573faeb6ff6d72ad8a3ac5b1c58b48e
Contents?: true
Size: 769 Bytes
Versions: 24
Compression:
Stored size: 769 Bytes
Contents
# frozen_string_literal: true module Mongoid module Validatable module Queryable # Wrap the validation inside the an execution block that alert's the # client not to clear its persistence options. # # @example Execute the validation with a query. # with_query(document) do # #... # end # # @param [ Document ] document The document being validated. # # @return [ Object ] The result of the yield. def with_query(document) klass = document.class begin Threaded.begin_execution("#{klass.name}-validate-with-query") yield ensure Threaded.exit_execution("#{klass.name}-validate-with-query") end end end end end
Version data entries
24 entries across 24 versions & 1 rubygems