lib/paperclip.rb in thoughtbot-paperclip-2.2.1 vs lib/paperclip.rb in thoughtbot-paperclip-2.2.2
- old
+ new
@@ -41,11 +41,11 @@
# The base module that gets included in ActiveRecord::Base. See the
# documentation for Paperclip::ClassMethods for more useful information.
module Paperclip
- VERSION = "2.2.1"
+ VERSION = "2.2.2"
class << self
# Provides configurability to Paperclip. There are a number of options available, such as:
# * whiny_thumbnails: Will raise an error if Paperclip cannot process thumbnails of
# an uploaded image. Defaults to true.
@@ -253,10 +253,10 @@
def validates_attachment_content_type name, options = {}
attachment_definitions[name][:validations][:content_type] = lambda do |attachment, instance|
valid_types = [options[:content_type]].flatten
unless attachment.original_filename.blank?
- unless options[:content_type].blank?
+ unless valid_types.blank?
content_type = attachment.instance_read(:content_type)
unless valid_types.any?{|t| t === content_type }
options[:message] || "is not one of the allowed file types."
end
end