From 0c2dc9f957f8277e8b93c609b1173af9e0d4be5b Mon Sep 17 00:00:00 2001 From: dinsmol Date: Fri, 30 Jul 2021 14:30:02 +0300 Subject: [PATCH] codeclimate fix (api_users) --- app/controllers/admin/api_users_controller.rb | 7 +++++-- app/views/admin/api_users/index.html.erb | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin/api_users_controller.rb b/app/controllers/admin/api_users_controller.rb index ccdd1c526..3ca70d543 100644 --- a/app/controllers/admin/api_users_controller.rb +++ b/app/controllers/admin/api_users_controller.rb @@ -5,8 +5,7 @@ module Admin def index @q = ApiUser.includes(:registrar).search(params[:q]) @api_users = @q.result.page(params[:page]) - @count = @q.result.count - @api_users = @api_users.per(params[:results_per_page]) if params[:results_per_page].to_i.positive? + api_users_paginate if params[:results_per_page].to_i.positive? end def new @@ -58,5 +57,9 @@ module Admin def registrar Registrar.find(params[:registrar_id]) end + + def api_users_paginate + @api_users = @api_users.per(params[:results_per_page]) + end end end diff --git a/app/views/admin/api_users/index.html.erb b/app/views/admin/api_users/index.html.erb index a622a06a2..b34b00a66 100644 --- a/app/views/admin/api_users/index.html.erb +++ b/app/views/admin/api_users/index.html.erb @@ -36,7 +36,7 @@