Class: ThreadSafeUniquenessRecord::FindOrCreateBy
- Inherits:
-
Object
- Object
- ThreadSafeUniquenessRecord::FindOrCreateBy
- Defined in:
- lib/thread_safe_uniqueness_record/find_or_create_by.rb
Class Method Summary collapse
Class Method Details
.call(model_klass:, attributes:) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/thread_safe_uniqueness_record/find_or_create_by.rb', line 3 def self.call(model_klass:, attributes:) ThreadSafeUniquenessRecord.with_retry do ActiveRecord::Base.transaction(requires_new: true) do model_klass.find_or_create_by!(attributes) end end end |