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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to