Class: ExportObjects::Trial

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

Class Method Summary collapse

Class Method Details

.export(content) ⇒ Object



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

def self.export content
  file_name = Time.now.to_s + "_file.txt"
  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