Project must have namespace for Project#find_with_namespace
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
17a9ecf8cf
commit
25f68a71d6
1 changed files with 6 additions and 8 deletions
|
@ -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
|
||||
return nil unless id.include?("/")
|
||||
|
||||
where(namespace_id: namespace.id).find_by(path: id.second)
|
||||
else
|
||||
where(path: id, namespace_id: nil).last
|
||||
end
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue