Commit 97a92f8a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fixed user.namespace_id exception if namespace is nil

parent c31d48dd
...@@ -47,9 +47,8 @@ class Admin::ProjectsController < AdminController ...@@ -47,9 +47,8 @@ class Admin::ProjectsController < AdminController
def project def project
id = params[:project_id] || params[:id] id = params[:project_id] || params[:id]
id = id.split("/") if id.include?("/")
@project ||= Project.find_by_path(id) @project = Project.find_with_namespace(id)
@project || render_404 @project || render_404
end end
end end
...@@ -72,7 +72,6 @@ class User < ActiveRecord::Base ...@@ -72,7 +72,6 @@ class User < ActiveRecord::Base
alias_attribute :private_token, :authentication_token alias_attribute :private_token, :authentication_token
delegate :path, to: :namespace, allow_nil: true, prefix: true delegate :path, to: :namespace, allow_nil: true, prefix: true
delegate :id, to: :namespace, allow_nil: true, prefix: true
# Scopes # Scopes
scope :not_in_project, ->(project) { where("id not in (:ids)", ids: project.users.map(&:id) ) } scope :not_in_project, ->(project) { where("id not in (:ids)", ids: project.users.map(&:id) ) }
......
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