Module: Gluttonberg::Membership::Export::ClassMethods

Defined in:
lib/gluttonberg/membership/export.rb

Instance Method Summary collapse

Instance Method Details

#exportCSVObject

export to a csv



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/gluttonberg/membership/export.rb', line 8

def exportCSV
  all_records = self.order("id asc").all
  require 'csv'
  other_columns = {}
  CSV.generate do |csv|
    other_columns = find_other_columns
    csv << prepare_header_row
    all_records.each do |record|
      csv << prepare_row(record, other_columns)
    end
  end
end