Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use attachment_for when validating attachments. Never know when someo…

…ne might alias the method.
  • Loading branch information...
commit 4a05a8a59d7324e072906602dc3f84ff1c8bcd72 1 parent ca481b4
@jyurek jyurek authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  lib/paperclip.rb
View
3  lib/paperclip.rb
@@ -207,7 +207,8 @@ def has_attached_file name, options = {}
end
validates_each(name) do |record, attr, value|
- value.send(:flush_errors) unless value.valid?
+ attachment = record.attachment_for(name)
+ attachment.send(:flush_errors) unless attachment.valid?
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.