aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/validations/exclusion.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/lib/active_model/validations/exclusion.rb')
-rw-r--r--activemodel/lib/active_model/validations/exclusion.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/validations/exclusion.rb b/activemodel/lib/active_model/validations/exclusion.rb
index 599623368f..6fe43c7219 100644
--- a/activemodel/lib/active_model/validations/exclusion.rb
+++ b/activemodel/lib/active_model/validations/exclusion.rb
@@ -9,8 +9,9 @@ module ActiveModel
end
def validate_each(record, attribute, value)
- return unless options[:in].include?(value)
- record.errors.add(attribute, :exclusion, :default => options[:message], :value => value)
+ if options[:in].include?(value)
+ record.errors.add(attribute, :exclusion, options.except(:in).merge(:value => value))
+ end
end
end