diff options
-rw-r--r-- | app/models/project.rb | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 6425940b21d..7d7edc45739 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -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 |