diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-11-29 08:29:11 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-11-29 14:39:03 +0400 |
commit | eb1004f7890d25a86beb0ca0a7eca802d9fce665 (patch) | |
tree | 94cb713c0628542e646aad323be4d88fb1c356e3 /app/controllers/admin | |
parent | a1ffc673b95f4d0e2316d461f1364fa1ee08e9d2 (diff) |
Refactor abilities. Added ProjectUpdate context. Fixed few bugs with namespaces
Diffstat (limited to 'app/controllers/admin')
-rw-r--r-- | app/controllers/admin/projects_controller.rb | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index c3a419afd0f..e61f94f8cf3 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -24,13 +24,9 @@ class Admin::ProjectsController < AdminController end def update - owner_id = params[:project].delete(:owner_id) + status = ProjectUpdateContext.new(project, current_user, params).execute(:admin) - if owner_id - @project.owner = User.find(owner_id) - end - - if @project.update_attributes(params[:project], as: :admin) + if status redirect_to [:admin, @project], notice: 'Project was successfully updated.' else render action: "edit" |