You're probably better off starting by looking at Paperclip's S3 support, which is logically closer to what you want to do.
--Matt Jones On Oct 3, 10:15 am, James West <[email protected]> wrote: > Hi all, > I'm needing to extend the Paperclip Storage module to handle external > URL's so that I can upload my doc's/images to an external source rather > than the app's local file system. > > The FileSystem module reads > > module Filesystem > def self.extended base > end > > def exists?(style = default_style) > if original_filename > File.exist?(path(style)) > else > false > end > end > > # Returns representation of the data of the file assigned to the > given > # style, in the format most representative of the current storage. > def to_file style = default_style > @queued_for_write[style] || (File.new(path(style)) if > exists?(style)) > end > alias_method :to_io, :to_file > > def flush_writes #:nodoc: > @queued_for_write.each do |style, file| > FileUtils.mkdir_p(File.dirname(path(style))) > result = file.stream_to(path(style)) > file.close > result.close > end > @queued_for_write = {} > end > > def flush_deletes #:nodoc: > @queued_for_delete.each do |path| > begin > FileUtils.rm(path) if File.exist?(path) > rescue Errno::ENOENT => e > # ignore file-not-found, let everything else pass > end > end > @queued_for_delete = [] > end > end > > Now I figured that I should be able to make use of Open-URI to emulate > the above functionality so that Paperclips expected behaviour is fully > implemented. > > What I could do with is a good resource that can show me how I can > emulate the same functionality with Open-URI. > > Any pointers to good examples, ideas, code snippets, examples, help > etc... would be greatly appreciated > -- > Posted viahttp://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

