korobkov-paperclip 2.3.1.200909221741 → 2.3.1.200909222157
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/paperclip.rb +3 -4
- data/lib/paperclip/attachment.rb +1 -1
- data/lib/paperclip/upfile.rb +5 -6
- data/tasks/paperclip_tasks.rake +1 -1
- metadata +1 -1
    
        data/lib/paperclip.rb
    CHANGED
    
    | @@ -347,7 +347,6 @@ module Paperclip | |
| 347 347 | 
             
            end
         | 
| 348 348 |  | 
| 349 349 | 
             
            # Set it all up.
         | 
| 350 | 
            -
            if Object.const_defined?("ActiveRecord")
         | 
| 351 | 
            -
             | 
| 352 | 
            -
             | 
| 353 | 
            -
            end
         | 
| 350 | 
            +
            ActiveRecord::Base.send(:include, Paperclip) if Object.const_defined?("ActiveRecord")
         | 
| 351 | 
            +
            Tempfile.send(:include, Paperclip::Upfile)
         | 
| 352 | 
            +
            File.send(:include, Paperclip::Upfile)
         | 
    
        data/lib/paperclip/attachment.rb
    CHANGED
    
    | @@ -80,7 +80,7 @@ module Paperclip | |
| 80 80 |  | 
| 81 81 | 
             
                  @queued_for_write[:original]   = uploaded_file.to_tempfile
         | 
| 82 82 | 
             
                  instance_write(:file_name,       uploaded_file.original_filename.strip.gsub(/[^A-Za-z\d\.\-_]+/, '_'))
         | 
| 83 | 
            -
                  instance_write(:content_type,    uploaded_file.content_type | 
| 83 | 
            +
                  instance_write(:content_type,    uploaded_file.content_type)
         | 
| 84 84 | 
             
                  instance_write(:file_size,       uploaded_file.size.to_i)
         | 
| 85 85 | 
             
                  instance_write(:file_hexdigest,  uploaded_file.hexdigest)
         | 
| 86 86 | 
             
                  instance_write(:updated_at,      Time.now)
         | 
    
        data/lib/paperclip/upfile.rb
    CHANGED
    
    | @@ -9,7 +9,11 @@ module Paperclip | |
| 9 9 |  | 
| 10 10 | 
             
                # Infer the MIME-type of the file from the magic.
         | 
| 11 11 | 
             
                def content_type
         | 
| 12 | 
            -
             | 
| 12 | 
            +
                  unless MimeMagic.by_magic(self).nil?
         | 
| 13 | 
            +
                    MimeMagic.by_magic(self).type
         | 
| 14 | 
            +
                  else
         | 
| 15 | 
            +
                    "application/octet-stream"
         | 
| 16 | 
            +
                  end
         | 
| 13 17 | 
             
                end
         | 
| 14 18 |  | 
| 15 19 | 
             
                # Returns the file's normal name.
         | 
| @@ -40,8 +44,3 @@ if defined? StringIO | |
| 40 44 | 
             
                end
         | 
| 41 45 | 
             
              end
         | 
| 42 46 | 
             
            end
         | 
| 43 | 
            -
             | 
| 44 | 
            -
            class File #:nodoc:
         | 
| 45 | 
            -
              include Paperclip::Upfile
         | 
| 46 | 
            -
            end
         | 
| 47 | 
            -
             | 
    
        data/tasks/paperclip_tasks.rake
    CHANGED
    
    | @@ -54,7 +54,7 @@ namespace :paperclip do | |
| 54 54 | 
             
                  for_all_attachments do |instance, name|
         | 
| 55 55 | 
             
                    if file = instance.send(name).to_file
         | 
| 56 56 | 
             
                      instance.send("#{name}_file_name=", instance.send("#{name}_file_name").strip)
         | 
| 57 | 
            -
                      instance.send("#{name}_content_type=", file.content_type | 
| 57 | 
            +
                      instance.send("#{name}_content_type=", file.content_type)
         | 
| 58 58 | 
             
                      instance.send("#{name}_file_size=", file.size) if instance.respond_to?("#{name}_file_size")
         | 
| 59 59 | 
             
                      instance.send("#{name}_file_hexdigest=", file.hexdigest) if instance.respond_to?("#{name}_file_hexdigest")
         | 
| 60 60 | 
             
                      instance.save(false)
         |