Commit 0125b74b authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Fix application crashes after #2772

parent 71e89df5
class Admin::UsersController < Admin::ApplicationController
before_filter :admin_user, only: [:show, :edit, :update, :destroy]
def index
@admin_users = User.scoped
@admin_users = @admin_users.filter(params[:filter])
......@@ -7,11 +9,8 @@ def index
end
def show
projects = if admin_user.authorized_projects.empty?
Project
else
Project.without_user(admin_user)
end.all
@projects = Project.scoped
@projects = @projects.without_user(admin_user) if admin_user.authorized_projects.empty?
end
def team_update
......@@ -102,6 +101,6 @@ def destroy
protected
def admin_user
@admin_user ||= User.find_by_username(params[:id])
@admin_user ||= User.find_by_username!(params[:id])
end
end
......@@ -49,7 +49,7 @@
# Admin Area
#
namespace :admin do
resources :users do
resources :users, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do
member do
put :team_update
put :block
......
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