This works just fine in my dev environment (I am rewriting a css file):
File.open(RAILS_ROOT + '\public\stylesheets\colors.css', 'w') do |w|
w.puts 'some_text'
end
But when I run it in my prod environment (on Dreamhost) nothing happens - the file is not modified - nothing.
What I need to be able to do is to overwrite an existing file, which I can't seem to figure out in production. I even set the chmod to 777 and that didn't change anything, it also doesn't appear that anything is showing up in the logs?
I am a noob in RoR, I appreciate the help.
You are writing to a file called \public\stylesheets\colors.css
when you would really like to write to a file called colors.css
in /public/stylesheets/
Backslash, \
, is a valid filename character in POSIX filesystems, but is the directory separator in NTFS. Change your backslashes to forward slashes.