tab/app/datatables/transaction_datatable.rb
2015-09-09 11:31:34 +02:00

27 lines
612 B
Ruby

class TransactionDatatable < AjaxDatatablesRails::Base
include TransactionsHelper
def sortable_columns
@sortable_columns ||= ['Transaction.created_at']
end
def searchable_columns
@searchable_columns ||= []
end
private
def data
records.map do |record|
[ amount_in_perspective(record, options[:user]),
record.origin,
record.message,
get_transaction_peer(record, options[:user]).name,
record.created_at.strftime('%d/%m/%y %H:%M')
]
end
end
def get_raw_records
options[:user].transactions.eager_load(:debtor, :creditor)
end
end