WHAT COULD POSSIBLY GO WRONG?
WHAT COULD POSSIBLY GO WRONG?
ROOT CAUSE
ROOT CAUSE
FIX
FIX
# REST client
get('/records', **params.slice(:product_gids))
# DB query in billing
def billing_records(product_gids: nil, gids: nil, client_gid: nil)
scope = ::BillingRecord
scope = scope.where(product_gid: product_gids) if product_gids
scope = scope.where(gid: gids) if gids
scope = scope.where(client_gid: client_gid) if client_gid
scope.all
end
def billing_records(product_gids: nil, gids: nil, client_gid: nil)
return [] if [product_gids, gids, client_gid].all?(&:blank?)
# ...
end