Commit 93f4f3cd by Jon Yurek

#67 Fixed passing validations still existing in errors hash.

parent c751827d
......@@ -117,7 +117,7 @@ module Paperclip
# Returns true if there are no errors on this attachment.
def valid?
validate
errors.length == 0
errors.empty?
end
# Returns an array containing the errors on this attachment.
......@@ -235,6 +235,7 @@ module Paperclip
errors[name] = block.call(self, instance) if block
errors
end
@validation_errors.reject!{|k,v| v == nil }
@errors.merge!(@validation_errors)
end
@validation_errors
......
......@@ -147,7 +147,7 @@ class PaperclipTest < Test::Unit::TestCase
@dummy.valid?
end
should "not have an error when assigned a valid file" do
assert_nil @dummy.avatar.errors[validation]
assert ! @dummy.avatar.errors.key?(validation)
end
should "not have an error on the attachment" do
assert_nil @dummy.errors.on(:avatar)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment