Ruby method that is validating the payload received
Inline conditionals would make this a bit cleaner:

def disbursements
  @invoice = Invoice.find(params[:id])

  @invoice.errors[:invoice_id] &lt;&lt; 'invoice_id can not be blank' if @invoice.invoice_id.nil?
  @invoice.errors[:trips] &lt;&lt; 'Funds can not be disbursed yet.' if Time.now.utc &lt;= @invoice.trips.first
  @invoice.errors[:cancelled] &lt;&lt; 'This invoice was already been cancelled.' if @invoice.cancelled
  @invoice.errors[:service_rendered] &lt;&lt; 'This invoice has already been disbursed.' if @invoice.service_rendered

  return render json: @invoice.errors, status: :unprocessable_entity if @invoice.errors.any?
  ...
end


We can slim the method down and save a lot of space that way.

I removed the utc_time variable because it was only used once.