From 37758f9e237bfe8edd0730295e9235e205d7db37 Mon Sep 17 00:00:00 2001 From: CL Date: Thu, 16 May 2019 10:25:04 +0800 Subject: [PATCH] Better expression Co-Authored-By: James Chen --- app/controllers/api/v2/transactions_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/v2/transactions_controller.rb b/app/controllers/api/v2/transactions_controller.rb index 34cbd1b..11ce4b6 100644 --- a/app/controllers/api/v2/transactions_controller.rb +++ b/app/controllers/api/v2/transactions_controller.rb @@ -29,7 +29,7 @@ def index # FIXME: should order by block_number and index desc, change block_number to integer transactions = Transaction.ransack(options).result.order(updated_at: :desc) - if params[:page].nil? && (!params[:offset].nil? || !params[:limit].nil?) + if params[:page].nil? && (params[:offset].present? || params[:limit].present?) offset = params[:offset] || 0 limit = params[:limit] || 10 transactions = transactions.offset(offset).limit(limit)