Write a file oin ruby on rails


log_path = '/home/project/logs'
system("mkdir #{log_path}") if !File.directory?(log_path)
log_content = "test content"
File.open("#{log_path}/log_#{Time.now.to_i}.txt", 'a') { |file|
  file.write "#{log_content}"
}

No comments:

Post a Comment