This will return all the data that DataTables expects including all the relevant rows from the database.
# File app/datatables/messages_datatable.rb, line 6 def as_json(options = {}) as_datatable(@options[:chat_conversation].messages) end
This fetches the correct page of data in the correct order.
# File app/datatables/messages_datatable.rb, line 11 def data_hash(message) data = { id: message.id, created_at: message.created_at.day_month_date_hr_min_mer, message: messages_url_link(message), sender_name: message.sender.full_name } end
Provide the sequence in which columns to be sorted.
# File app/datatables/messages_datatable.rb, line 21 def sort_columns ['NULL','NULL','created_at'] end