Class: FormCreation::Post

Inherits:
ApplicationRecord show all
Defined in:
app/models/form_creation/post.rb

Class Method Summary collapse

Class Method Details

.to_csv(options = {}) ⇒ Object

Export xls sheet



8
9
10
11
12
13
14
15
# File 'app/models/form_creation/post.rb', line 8

def self.to_csv(options = {})
 	CSV.generate(options) do |csv|
   	csv << column_names
   	all.each do |post|
      csv << post.attributes.values_at(*column_names)
    end
 	end
end