app/jobs/record_index_status_job.rb
# Inspired by Rails 6's create_or_find_by method
Inspired by Rails 6's create_or_find_by method
Inspired by Rails 6 ' s create_or_find_by method
def create_or_find_sidecar(relation, attributes = {})
    relation.transaction(requires_new: true) do
      relation.create(attributes)
    end
  rescue ActiveRecord::RecordNotUnique
    relation.find_by!(attributes)
  end
def create_or_find_sidecar ( relation , attributes = { } ) relation . transaction ( requires_new : true ) do relation . create ( attributes ) end rescue ActiveRecord :: RecordNotUnique relation . find_by! ( attributes ) end
Inspired by Rails 6's create_or_find_by method
Inspired by Rails 6 ' s create_or_find_by method
relation
attributes