Fixes that custom values length and attachment size validation error raises an error.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2667 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang committed 2009-04-08 16:56:01 +00:00
1 parent a4a41e05a8
commit 1c03b98e5d
2 files changed
+5 -3

No files matched your search

+3 -1
View File
@@ -46,7 +46,9 @@ class Attachment < ActiveRecord::Base
@@storage_path = "#{RAILS_ROOT}/files"
def validate
errors.add_to_base :too_long if self.filesize > Setting.attachment_max_size.to_i.kilobytes
if self.filesize > Setting.attachment_max_size.to_i.kilobytes
errors.add(:base, :too_long, :count => Setting.attachment_max_size.to_i.kilobytes)
end
end
def file=(incoming_file)