On Mon, Jan 12, 2009 at 4:37 PM, DAZ firstname.lastname@example.org wrote:
If this is possible, how do you do it?
To get the contents, you could do:
@file_contents = File.read(File.join(RAILS_ROOT, “public”,
And to save again, do:
File.open(File.join(RAILS_ROOT, “public”, “your_file_name.css”)) do
NOTE: I’d be very careful of actually doing this though as there are
Think through things like who will have access to this functionality and
much they can be trusted.
One thing to specifically check for is that the user cannot set the file
path in any way or you could end up with files written to like:
Have a look at http://guides.rubyonrails.org/security.html for some more
detailed info on the potential problems.
“I have never let my schooling interfere with my education” - Mark Twain