lib/paperclip.rb in paperclip-2.3.0 vs lib/paperclip.rb in paperclip-2.3.1
- old
+ new
@@ -42,11 +42,11 @@
# The base module that gets included in ActiveRecord::Base. See the
# documentation for Paperclip::ClassMethods for more useful information.
module Paperclip
- VERSION = "2.3.0"
+ VERSION = "2.3.1"
class << self
# Provides configurability to Paperclip. There are a number of options available, such as:
# * whiny: Will raise an error if Paperclip cannot process thumbnails of
# an uploaded image. Defaults to true.
@@ -91,11 +91,11 @@
#
# This method can log the command being run when
# Paperclip.options[:log_command] is set to true (defaults to false). This
# will only log if logging in general is set to true as well.
def run cmd, params = "", expected_outcodes = 0
- command = %Q<#{%Q[#{path_for_command(cmd)} #{params}].gsub(/\s+/, " ")}>
+ command = %Q[#{path_for_command(cmd)} #{params}].gsub(/\s+/, " ")
command = "#{command} 2>#{bit_bucket}" if Paperclip.options[:swallow_stderr]
Paperclip.log(command) if Paperclip.options[:log_command]
output = `#{command}`
unless [expected_outcodes].flatten.include?($?.exitstatus)
raise PaperclipCommandLineError, "Error while running #{cmd}"
@@ -255,10 +255,12 @@
min = options[:greater_than] || (options[:in] && options[:in].first) || 0
max = options[:less_than] || (options[:in] && options[:in].last) || (1.0/0)
range = (min..max)
message = options[:message] || "file size must be between :min and :max bytes."
- attachment_definitions[name][:validations] << [:size, {:range => range,
+ attachment_definitions[name][:validations] << [:size, {:min => min,
+ :max => max,
+ :range => range,
:message => message,
:if => options[:if],
:unless => options[:unless]}]
end