Make API more friendly
This commit is contained in:
parent
f884506abc
commit
0e9b607061
1 changed files with 12 additions and 1 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue