Skip to content

Commit

Permalink
Use .map(&:underscore)
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamsoftech committed Oct 9, 2019
1 parent 70ad84d commit 0ee7709
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 0ee7709

Please sign in to comment.