lib/paperclip.rb in paperclip-2.6.0 vs lib/paperclip.rb in paperclip-2.7.0
- old
+ new
@@ -321,11 +321,15 @@
self.attachment_definitions = {}
else
write_inheritable_attribute(:attachment_definitions, {})
end
else
- self.attachment_definitions = self.attachment_definitions.dup
+ if respond_to?(:class_attribute)
+ self.attachment_definitions = self.attachment_definitions.dup
+ else
+ write_inheritable_attribute(:attachment_definitions, self.attachment_definitions.dup)
+ end
end
attachment_definitions[name] = Paperclip::AttachmentOptions.new(options)
Paperclip.classes_with_attachments << self.name
Paperclip.check_for_url_clash(name,attachment_definitions[name][:url],self.name)
@@ -366,10 +370,10 @@
# * +unless+: Same as +if+ but validates if lambda or method returns false.
def validates_attachment_size name, options = {}
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"
+ message = options[:message] || "must be between :min and :max bytes"
message = message.call if message.respond_to?(:call)
message = message.gsub(/:min/, min.to_s).gsub(/:max/, max.to_s)
validates_inclusion_of :"#{name}_file_size",
:in => range,