Project must have namespace for Project#find_with_namespace

Signed-off-by: NDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
上级 17a9ecf8
......@@ -177,15 +177,13 @@ class Project < ActiveRecord::Base
end
def find_with_namespace(id)
if id.include?("/")
id = id.split("/")
namespace = Namespace.find_by(path: id.first)
return nil unless namespace
where(namespace_id: namespace.id).find_by(path: id.second)
else
where(path: id, namespace_id: nil).last
end
return nil unless id.include?("/")
id = id.split("/")
namespace = Namespace.find_by(path: id.first)
return nil unless namespace
where(namespace_id: namespace.id).find_by(path: id.second)
end
def visibility_levels
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册