To access files in rails, you can use the Ruby File Class
http://ruby-doc.org/core/classes/File.html#M002579
You can put this into a method in the model. Then either call it
specifically from the controller, or use an after_update callback to
automatically create the file after the object has been saved to the
database
def save_file(filename)
File.open "#{RAILS_ROOT}/tmp/#{filename}", ''w'' do
|f|
f.write contents
end
end
Tonypm
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.