lib/attachment_fu/methods.rb in mdarby-scribd_fu-1.2.3.1 vs lib/attachment_fu/methods.rb in mdarby-scribd_fu-1.2.3.2

- old
+ new

@@ -50,13 +50,13 @@ # Uploads the attachment to scribd for processing.. This is called # +before_validation+, as set up by ScribdFu::ClassMethods#extended. def upload_to_scribd if scribdable? and self.scribd_id.blank? with_file_path do |file_path| - if resource = scribd_login.upload(:file => "#{file_path}", :access => access_level) - logger.info "[Scribd_fu] #{Time.now.rfc2822}: Uploaded '#{file_path}' to Scribd" - logger.info "[Scribd_fu] #{Time.now.rfc2822}: Object #{id} successfully uploaded for conversion to iPaper" + if resource = scribd_login.upload(:file => "#{file_path}", + :access => access_level) + logger.info "[Scribd_fu] #{Time.now.rfc2822}: Object #{id} successfully uploaded for conversion to iPaper." self.scribd_id = resource.doc_id self.scribd_access_key = resource.access_key save @@ -106,10 +106,10 @@ # necessary, so as to be able to give scribd the right filename. The file # is destroyed when the passed block ends. def with_file_path(&block) # :yields: full_file_path # TODO We can probably do this using respond_to? if scribd_config['storage'].eql?('s3') - yield public_filename + yield s3_url elsif save_attachment? # file hasn't been saved, use the temp file temp_rename = File.join(Dir.tmpdir, filename) File.copy(temp_path, temp_rename) yield temp_rename