Make API more friendly

This commit is contained in:
redfast00 2019-04-11 17:34:23 +02:00
parent f884506abc
commit 0e9b607061
No known key found for this signature in database
GPG key ID: 5946E0E34FD0553C

View file

@ -4,7 +4,18 @@ class TransactionsController < ApplicationController
def index def index
@transactions = @user.transactions @transactions = @user.transactions
respond_to do |format| respond_to do |format|
format.json { render json: @transactions } format.json {
render json: @transactions.map {|t| {
:id => t.id,
:debtor => t.debtor.name,
:creditor => t.creditor.name,
:time => t.updated_at,
:amount => t.amount,
:message => t.message,
:issuer => t.issuer.name
}
}
}
end end
end end