lib/paperclip.rb in paperclip-4.2.4 vs lib/paperclip.rb in paperclip-4.3.0
- old
+ new
@@ -53,15 +53,25 @@
require 'paperclip/logger'
require 'paperclip/helpers'
require 'paperclip/has_attached_file'
require 'paperclip/attachment_registry'
require 'paperclip/filename_cleaner'
-require 'mime/types'
+require 'paperclip/rails_environment'
+
+begin
+ # Use mime/types/columnar if available, for reduced memory usage
+ require "mime/types/columnar"
+rescue LoadError
+ require "mime/types"
+end
+
+require 'mimemagic'
+require 'mimemagic/overlay'
require 'logger'
require 'cocaine'
-require 'paperclip/railtie' if defined?(Rails)
+require 'paperclip/railtie' if defined?(Rails::Railtie)
# The base module that gets included in ActiveRecord::Base. See the
# documentation for Paperclip::ClassMethods for more useful information.
module Paperclip
extend Helpers
@@ -134,10 +144,10 @@
# has_attached_file :avatar, :styles => { :normal => "100x100#" },
# :default_style => :normal
# user.avatar.url # => "/avatars/23/normal_me.png"
# * +keep_old_files+: Keep the existing attachment files (original + resized) from
# being automatically deleted when an attachment is cleared or updated. Defaults to +false+.
- # * +preserve_files+: Keep the existing attachment files in all cases, even if the parent
+ # * +preserve_files+: Keep the existing attachment files in all cases, even if the parent
# record is destroyed. Defaults to +false+.
# * +whiny+: Will raise an error if Paperclip cannot post_process an uploaded file due
# to a command line error. This will override the global setting for this attachment.
# Defaults to true.
# * +convert_options+: When creating thumbnails, use this free-form options