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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -