Commit 8ff1ec36 authored by Steve Abrams's avatar Steve Abrams

Update to use safe_find_or_create_by

parent f8ae33ca
......@@ -153,9 +153,8 @@ class ContainerRepository < ApplicationRecord
end
def self.create_from_path!(path)
build_from_path(path).tap(&:save!)
rescue ActiveRecord::RecordNotUnique, ActiveRecord::RecordInvalid
self.find_by_path!(path)
safe_find_or_create_by!(project: path.repository_project,
name: path.repository_name)
end
def self.build_root_repository(project)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment