I have this code:
file = File.open(model_file_path, 'w') do |f|
f << YAML.dump(attributes)
end
s3_bucket.object(filename).upload_file(file)
And it's throwing this error:
IOError: closed stream
from /var/www/my_app/shared/bundle/ruby/2.4.0/gems/aws-sdk-resources-2.10.126/lib/aws-sdk-resources/services/s3/file_uploader.rb:31:in `size'
from /var/www/my_app/shared/bundle/ruby/2.4.0/gems/aws-sdk-resources-2.10.126/lib/aws-sdk-resources/services/s3/file_uploader.rb:31:in `upload'
from /var/www/my_app/shared/bundle/ruby/2.4.0/gems/aws-sdk-resources-2.10.126/lib/aws-sdk-resources/services/s3/object.rb:252:in `upload_file'
from (irb):44
What's causing the error? Am I saving it wrong?
The file needs to be in an open state to be uploaded: