From 0ee77094784474139bfbbda76f7eecebc0e42f66 Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 9 Oct 2019 22:22:23 +0800 Subject: [PATCH] Use .map(&:underscore) --- .../authentication/devise/admin/users_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/refinery/authentication/devise/admin/users_controller.rb b/app/controllers/refinery/authentication/devise/admin/users_controller.rb index 354d6c8..c7dd389 100644 --- a/app/controllers/refinery/authentication/devise/admin/users_controller.rb +++ b/app/controllers/refinery/authentication/devise/admin/users_controller.rb @@ -41,13 +41,13 @@ def update @selected_plugin_names = params[:user][:plugins] if user_is_locking_themselves_out? - flash.now[:error] = t('lockout_prevented', :scope => 'refinery.authentication.devise.admin.users.update') - render :edit and return + flash.now[:error] = t('lockout_prevented', scope: 'refinery.authentication.devise.admin.users.update') + render :edit && return end store_user_memento - @user.roles = @selected_role_names.map { |r| Refinery::Authentication::Devise::Role[r.underscore] } + @user.roles = @selected_role_names.map(&:underscore) if @user.update_attributes user_params.to_h update_successful else @@ -63,7 +63,7 @@ def create_successful # if the user is a superuser and can assign roles according to this site's # settings then the roles are set with the POST data. if user_can_assign_roles? - @user.roles = @selected_role_names.map { |r| Refinery::Authentication::Devise::Role[r.downcase] } + @user.roles = @selected_role_names.map(&:underscore) else @user.add_role :refinery end