Sha256: c25280df79252320e755cc53a04bcf6c196df60c623e5639ce6b551fbd75a27c
Contents?: true
Size: 785 Bytes
Versions: 59
Compression:
Stored size: 785 Bytes
Contents
# encoding: utf-8 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. # # @since 3.0.2 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
59 entries across 55 versions & 3 rubygems