diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-26 14:08:34 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-26 14:08:34 +0400 |
commit | 0125b74b3cbdb7df3b029cd2373b96ca3905c16a (patch) | |
tree | 2cc7b6f85e90d02eaebb079c962077f4b20dce7d /app | |
parent | 71e89df5e061e4c3a372977e7e6fb25f42791414 (diff) |
Fix application crashes after #2772
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin/users_controller.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 0c7f97dd72c..ed421624295 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -1,4 +1,6 @@ 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 @@ class Admin::UsersController < Admin::ApplicationController 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 @@ class Admin::UsersController < Admin::ApplicationController protected def admin_user - @admin_user ||= User.find_by_username(params[:id]) + @admin_user ||= User.find_by_username!(params[:id]) end end |