Don't create new users in transactions

This commit is contained in:
redfast00 2019-05-07 16:01:54 +02:00
parent 7f30b99dde
commit a727dfb1dd
No known key found for this signature in database
GPG key ID: 5946E0E34FD0553C

View file

@ -49,8 +49,8 @@ class TransactionsController < ApplicationController
.permit(:debtor, :creditor, :message, :euros, :cents, :id_at_client) .permit(:debtor, :creditor, :message, :euros, :cents, :id_at_client)
{ {
debtor: t[:debtor] ? User.find_or_create_by(name: t[:debtor]) : User.zeus, debtor: t[:debtor] ? User.find_by(name: t[:debtor]) : User.zeus,
creditor: t[:creditor] ? User.find_or_create_by(name: t[:creditor]) : User.zeus, creditor: t[:creditor] ? User.find_by(name: t[:creditor]) : User.zeus,
issuer: authenticate_user_or_client!, issuer: authenticate_user_or_client!,
amount: (t[:euros].to_f * 100 + t[:cents].to_f).to_i, amount: (t[:euros].to_f * 100 + t[:cents].to_f).to_i,
message: t[:message], message: t[:message],