Permalink
Browse files

Use attachment_for when validating attachments. Never know when someo…

…ne might alias the method.
  • Loading branch information...
1 parent ca481b4 commit 4a05a8a59d7324e072906602dc3f84ff1c8bcd72 @jyurek jyurek committed Feb 1, 2009
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

0 comments on commit 4a05a8a

Please sign in to comment.