Sha256: 1b493635106d606d0ff1f00da722de8a3a2d3828443971f1da0d52fccbef7bb3

Contents?: true

Size: 411 Bytes

Versions: 2

Compression:

Stored size: 411 Bytes

Contents

module FormCreation
  class Post < ApplicationRecord
  	validates :title, presence: true
  	validates :description, presence: true
  	validates :created_by, presence: true

   #Export xls sheet 
  	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
  end
end	

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
form_creation-0.2.0 app/models/form_creation/post.rb
form_creation-0.1.9 app/models/form_creation/post.rb