lib/purgatory/purgatory_module.rb in purgatory-2.3.0 vs lib/purgatory/purgatory_module.rb in purgatory-2.4.0
- old
+ new
@@ -5,12 +5,13 @@
def use_purgatory
self.has_many :purgatories, as: :soul
end
end
- def purgatory!(requester = nil)
+ def purgatory!(requester = nil, options = {})
return nil if self.invalid?
+ return nil if Purgatory.pending_with_matching_soul(self).any? && options[:fail_if_matching_soul]
Purgatory.create soul: self, requester: requester
end
class Configuration
attr_accessor :user_class_name
@@ -24,6 +25,6 @@
def configuration
@_configuration ||= Configuration.new
end
end
-end
\ No newline at end of file
+end