mess around with api params

This commit is contained in:
Ilion Beyst 2015-09-09 11:56:13 +02:00
parent d32bfc55fb
commit dbc533a1cb

View file

@ -22,7 +22,13 @@ class TransactionsController < ApplicationController
private private
def transaction_params def set_params
params.require(:transaction).permit(:creditor_id, :amount, :message) t = params.require(:transaction)
.permit(:debtor, :creditor, :amount, :message)
t.update {
debtor: User.find_by(name: t[:debtor]) || User.zeus,
creditor: User.find_by(name: t[:creditor]) || User.zeus
}
end end
end end