Permalink
Browse files

#67 Fixed passing validations still existing in errors hash.

  • Loading branch information...
1 parent c751827 commit 93f4f3cdc4a4d3ee40df74d6235d2cf899c92c1c @jyurek jyurek committed Nov 30, 2008
Showing with 3 additions and 2 deletions.
  1. +2 −1 lib/paperclip/attachment.rb
  2. +1 −1 test/paperclip_test.rb
@@ -117,7 +117,7 @@ def to_s style = nil
# 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 @@ def validate #:nodoc:
errors[name] = block.call(self, instance) if block
errors
end
+ @validation_errors.reject!{|k,v| v == nil }
@errors.merge!(@validation_errors)
end
@validation_errors
View
@@ -147,7 +147,7 @@ def self.should_validate validation, options, valid_file, invalid_file
@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)

0 comments on commit 93f4f3c

Please sign in to comment.