From d03aa606f75d56beffbacfc1e3a039df12e632c1 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Wed, 18 Dec 2019 11:18:17 +0100 Subject: [PATCH] rubocop suggestions --- app/controllers/application_controller.rb | 2 +- app/controllers/clients_controller.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 411e2f9b6..8b3cb79f6 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -65,7 +65,7 @@ def authenticate_user_with_basic_auth! def authenticate_user! type, credentials = type_and_credentials_from_request_headers - return false unless credentials.present? + return false if credentials.blank? @current_user = User.new(credentials, type: type) end diff --git a/app/controllers/clients_controller.rb b/app/controllers/clients_controller.rb index b388287fe..d4bf357e4 100644 --- a/app/controllers/clients_controller.rb +++ b/app/controllers/clients_controller.rb @@ -121,7 +121,7 @@ def create end def update - if @client.update_attributes(safe_params) + if @client.update(safe_params) options = {} options[:meta] = { dois: doi_count(client_id: params[:id]) } options[:is_collection] = false @@ -142,7 +142,7 @@ def destroy status = 400 logger.warn message render json: { errors: [{ status: status.to_s, title: message }] }.to_json, status: status - elsif @client.update_attributes(is_active: nil, deleted_at: Time.zone.now) + elsif @client.update(is_active: nil, deleted_at: Time.zone.now) @client.send_delete_email unless Rails.env.test? head :no_content else