Commit 97a92f8ae78a186aa76fcc860b570cf07c90c048

Authored by Dmitriy Zaporozhets
1 parent c31d48dd

Fixed user.namespace_id exception if namespace is nil

app/controllers/admin/projects_controller.rb
... ... @@ -47,9 +47,8 @@ class Admin::ProjectsController < AdminController
47 47  
48 48 def project
49 49 id = params[:project_id] || params[:id]
50   - id = id.split("/") if id.include?("/")
51 50  
52   - @project ||= Project.find_by_path(id)
  51 + @project = Project.find_with_namespace(id)
53 52 @project || render_404
54 53 end
55 54 end
... ...
app/models/user.rb
... ... @@ -72,7 +72,6 @@ class User < ActiveRecord::Base
72 72 alias_attribute :private_token, :authentication_token
73 73  
74 74 delegate :path, to: :namespace, allow_nil: true, prefix: true
75   - delegate :id, to: :namespace, allow_nil: true, prefix: true
76 75  
77 76 # Scopes
78 77 scope :not_in_project, ->(project) { where("id not in (:ids)", ids: project.users.map(&:id) ) }
... ...