Class: ExportObjects::Trial

Inherits:
Object
  • Object
show all
Defined in:
lib/export_objects.rb

Class Method Summary collapse

Class Method Details

.export(content) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/export_objects.rb', line 4

def self.export content
	file_name = Time.now.to_i
	models_path = File.join(Rails.root, 'tmp', 'pdfs')
	file_path = File.join(models_path, file_name)

	File.open(file_path, 'w') do |file|
		file.write(content)
	end

	puts "File created at: #{file_path}"
end