class PaymentsDatatable

Public Instance Methods

as_json(options = {}) click to toggle source

This will return all the data that DataTables expects including all the relevant rows from the database.

# File app/datatables/payments_datatable.rb, line 6
def as_json(options = {})
  conditions = {}
  as_datatable(Payment, conditions)
end
data_hash(payment) click to toggle source

This fetches the correct page of data in the correct order.

# File app/datatables/payments_datatable.rb, line 12
  def data_hash(payment)
    {
      transaction_id: payment.transaction_id,
      full_name: payment.user.present? ? payment.user.full_name : 'Not Available',
      type: payment._type,
      status: payment.status,
#      "$#{Money.new(payment.amount)}",
      amount: payment.amount,
      description: payment.description,
      action: update_payments_link(payment)
    }
  end
sort_columns() click to toggle source

Provide the sequence in which columns to be sorted.

# File app/datatables/payments_datatable.rb, line 26
def sort_columns
  %w(transaction_id)
end