Read/Write a FILE with filename containing a forward slash in Ruby -


how can read/write file filename containing forward slashes (/)?

this i'm trying -

filename = "a/b/c"  full_path = "#{rails.root}/public/barcodes/#{filename}.png"  file.open(full_path, 'w') { |f| f.write @barcode_png.to_png(:margin => 3, :xdim => 2,:ydim => 2, :height => 100) } 

everytime execute this, ruby tries find folder name a, b , c instead of writing file "a/b/c"

any thoughts on how make work?

thanks!


Comments