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
1 changed files with 12 additions and 1 deletions

View File

@ -4,7 +4,18 @@ class TransactionsController < ApplicationController
def index
@transactions = @user.transactions
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