Skip to content

Commit

Permalink
Admin attribute should be updatable by admins
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Byron committed May 3, 2011
1 parent af963ca commit aa3b7d0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/controllers/admin/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class Admin::UsersController < Admin::Base
before_filter :find_user, :only => [:edit, :update]
before_filter :update_protected_attrs, :only => [:update]

def index
order_by = []
Expand Down Expand Up @@ -36,4 +37,10 @@ def find_user
@user = User.find(params[:id])
end

def update_protected_attrs
admin = params[:user].delete(:admin)

@user.update_attribute(:admin, admin)
end

end

0 comments on commit aa3b7d0

Please sign in to comment.