lib/paperclip.rb in jcnetdev-paperclip-1.0.20080704 vs lib/paperclip.rb in jcnetdev-paperclip-1.1
- old
+ new
@@ -131,11 +131,11 @@
define_method "#{name}?" do
! attachment_for(name).original_filename.blank?
end
validates_each(name) do |record, attr, value|
- value.send(:flush_errors)
+ value.send(:flush_errors) unless value.valid?
end
end
# Places ActiveRecord-style validations on the size of the file assigned. The
# possible options are:
@@ -188,10 +188,10 @@
unless attachment.original_filename.nil?
unless options[:content_type].blank?
content_type = instance[:"#{name}_content_type"]
unless valid_types.any?{|t| t === content_type }
- options[:message] || ActiveRecord::Errors.default_error_messages[:inclusion]
+ options[:message] || "is not one of the allowed file types."
end
end
end
end
end