aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/validations/inclusion.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-05-15 21:55:16 +0200
committerJosé Valim <jose.valim@gmail.com>2010-05-15 21:55:16 +0200
commitd6cbb27e7b260c970bf7d07dc0b0591ed82cee2a (patch)
treeccd57aa2f19b43943ae6fb8e34fbb34b3a673726 /activemodel/lib/active_model/validations/inclusion.rb
parentf055bc05d515b80c89b99b775546b954f270bc5c (diff)
downloadrails-d6cbb27e7b260c970bf7d07dc0b0591ed82cee2a.tar.gz
rails-d6cbb27e7b260c970bf7d07dc0b0591ed82cee2a.tar.bz2
rails-d6cbb27e7b260c970bf7d07dc0b0591ed82cee2a.zip
Revert "Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options hash and make various Validators pass their (filtered) options."
Having a huge array to whitelist options is not the proper way to handle this case. This means that the ActiveModel::Errors object should know about the options given in *all* validators and break the extensibility added by the validators itself. If the intent is to whitelist options before sending them to I18n, each validator should clean its respective options instead of throwing the responsibility to the Errors object. This reverts commit bc1c8d58ec45593acba614d1d0fecb49adef08ff.
Diffstat (limited to 'activemodel/lib/active_model/validations/inclusion.rb')
-rw-r--r--activemodel/lib/active_model/validations/inclusion.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/validations/inclusion.rb b/activemodel/lib/active_model/validations/inclusion.rb
index 0ddf191b4f..446646d247 100644
--- a/activemodel/lib/active_model/validations/inclusion.rb
+++ b/activemodel/lib/active_model/validations/inclusion.rb
@@ -8,7 +8,7 @@ module ActiveModel
def validate_each(record, attribute, value)
return if options[:in].include?(value)
- record.errors.add(attribute, :inclusion, options.merge(:value => value))
+ record.errors.add(attribute, :inclusion, :default => options[:message], :value => value)
end
end