accept and use custom settle value

This commit is contained in:
Bilal
2020-10-05 14:25:42 +03:00
parent 6a6f650538
commit 04abd4be78
3 changed files with 6 additions and 5 deletions

View File

@@ -28,9 +28,10 @@ class HomiesController < ApplicationController
def settle
homie_id = params[:homie_id].to_i
amount = params[:amount].present? ? params[:amount].to_d : nil
homie = Homie.find(homie_id)
if homie.settle
if homie.settle(amount)
json_response []
else
error_response :bad_request