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 ...@@ -153,9 +153,8 @@ class ContainerRepository < ApplicationRecord
end end
def self.create_from_path!(path) def self.create_from_path!(path)
build_from_path(path).tap(&:save!) safe_find_or_create_by!(project: path.repository_project,
rescue ActiveRecord::RecordNotUnique, ActiveRecord::RecordInvalid name: path.repository_name)
self.find_by_path!(path)
end end
def self.build_root_repository(project) 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