Update benefits.rb accept binary file types.

The modification allows binary file types (e.g. MS word docs) to be uploaded without encountering encoding errors
This commit is contained in:
Rory McCune
2014-05-22 19:31:33 +01:00
parent 7acc17aea3
commit 239c96039b
+1 -1
View File
@@ -4,7 +4,7 @@ class Benefits < ActiveRecord::Base
def self.save(file, backup=false)
data_path = Rails.root.join("public", "data")
full_file_name = "#{data_path}/#{file.original_filename}"
f = File.open(full_file_name, "w+")
f = File.open(full_file_name, "wb+")
f.write file.read
f.close
make_backup(file, data_path, full_file_name) if backup == "true"