Sha256: e2a3d04275298e11f342d825140002affdcc19f81d68bf1551ea82f33ec84ec7
Contents?: true
Size: 575 Bytes
Versions: 5
Compression:
Stored size: 575 Bytes
Contents
require_dependency "renalware/reporting" module Renalware module Reporting class GenerateAuditJson def self.call(materialized_view_name) result = ActiveRecord::Base.connection.execute( "select * from #{materialized_view_name};" ) # Build a datatables compatible columnDefs hash columns = result.fields.each_with_index.inject([]) do |array, data| column_name, index = data array << { title: column_name, target: index } end [columns.to_json, result.values] end end end end
Version data entries
5 entries across 5 versions & 1 rubygems