API v1 Add financial_transaction_type to FinancialTransactions output
This commit is contained in:
parent
be269101f8
commit
88228022e3
4 changed files with 14 additions and 3 deletions
|
|
@ -2,11 +2,16 @@ class FinancialTransactionSerializer < ActiveModel::Serializer
|
|||
include ApplicationHelper
|
||||
|
||||
attributes :id, :user_id, :user_name, :amount, :note, :created_at
|
||||
attributes :financial_transaction_type_id, :financial_transaction_type_name
|
||||
|
||||
def user_name
|
||||
show_user object.user
|
||||
end
|
||||
|
||||
def financial_transaction_type_name
|
||||
object.financial_transaction_type.name
|
||||
end
|
||||
|
||||
def amount
|
||||
object.amount.to_f
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue