Permalink
Browse files

fixing the fix for Rails 2.2 - making it so it actually adds the erro…

…r - including the unless

Signed-off-by: rick <technoweenie@gmail.com>
  • Loading branch information...
1 parent 6e67b49 commit 81402bfa4afa0845f64cbeed294bd0e556f837e9 Dustin Anderson committed with technoweenie Feb 13, 2009
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/technoweenie/attachment_fu.rb
@@ -423,7 +423,7 @@ def attachment_attributes_valid?
[:size, :content_type].each do |attr_name|
enum = attachment_options[attr_name]
if Object.const_defined?(:I18n) # Rails >= 2.2
- I18n.translate("activerecord.errors.messages.inclusion", attr_name => enum)
+ errors.add attr_name, I18n.translate("activerecord.errors.messages.inclusion", attr_name => enum) unless enum.nil? || enum.include?(send(attr_name))
else
errors.add attr_name, ActiveRecord::Errors.default_error_messages[:inclusion] unless enum.nil? || enum.include?(send(attr_name))
end

0 comments on commit 81402bf

Please sign in to comment.