From c2b9b1fdd736efb55b12e09a9a66e4d783ceaafd Mon Sep 17 00:00:00 2001 From: jomo Date: Thu, 1 May 2014 20:14:42 +0200 Subject: [PATCH] fixed role bug --- app/controllers/users_controller.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 69bee43..b243fc8 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -129,14 +129,14 @@ class UsersController < ApplicationController def update @user = User.find(params[:id]) if (mod? && current_user.role >= @user.role ) || (@user.is?(current_user) && confirmed?) - userdata = user_params([:name, :role_id, :skype, :skype_public, :youtube, :twitter, :about]) - if userdata[:role_id] - role = Role.find(userdata[:role_id]) + userdata = user_params([:name, :role, :skype, :skype_public, :youtube, :twitter, :about]) + if userdata[:role] + role = Role.get(userdata[:role]) if (mod? && role <= current_user.role) - userdata[:role_id] = role.id + userdata[:role] = role else #reset role - userdata[:role_id] = @user.role.id + userdata.delete[:role] end end unless userdata[:ign] && (mod? && current_user.role >= @user.role)