Commit c8412bc9edbbed7a38cc4880f0d8cbb9091eb1d9

Authored by Dmitriy Zaporozhets
1 parent ce1b79af

Dont change params hash. Use dup instead

Showing 1 changed file with 3 additions and 2 deletions   Show diff stats
app/controllers/admin/groups_controller.rb
@@ -32,13 +32,14 @@ class Admin::GroupsController < AdminController @@ -32,13 +32,14 @@ class Admin::GroupsController < AdminController
32 end 32 end
33 33
34 def update 34 def update
35 - owner_id = params[:group].delete(:owner_id) 35 + group_params = params[:group].dup
  36 + owner_id =group_params.delete(:owner_id)
36 37
37 if owner_id 38 if owner_id
38 @group.owner = User.find(owner_id) 39 @group.owner = User.find(owner_id)
39 end 40 end
40 41
41 - if @group.update_attributes(params[:group]) 42 + if @group.update_attributes(group_params)
42 redirect_to [:admin, @group], notice: 'Group was successfully updated.' 43 redirect_to [:admin, @group], notice: 'Group was successfully updated.'
43 else 44 else
44 render action: "edit" 45 render action: "edit"