Commit c8412bc9 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Dont change params hash. Use dup instead

parent ce1b79af
...@@ -32,13 +32,14 @@ class Admin::GroupsController < AdminController ...@@ -32,13 +32,14 @@ class Admin::GroupsController < AdminController
end end
def update def update
owner_id = params[:group].delete(:owner_id) group_params = params[:group].dup
owner_id =group_params.delete(:owner_id)
if owner_id if owner_id
@group.owner = User.find(owner_id) @group.owner = User.find(owner_id)
end end
if @group.update_attributes(params[:group]) if @group.update_attributes(group_params)
redirect_to [:admin, @group], notice: 'Group was successfully updated.' redirect_to [:admin, @group], notice: 'Group was successfully updated.'
else else
render action: "edit" render action: "edit"
......
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