aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/validations/format.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/lib/active_model/validations/format.rb')
-rw-r--r--activemodel/lib/active_model/validations/format.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/validations/format.rb b/activemodel/lib/active_model/validations/format.rb
index c34c860d4d..2667baa5a0 100644
--- a/activemodel/lib/active_model/validations/format.rb
+++ b/activemodel/lib/active_model/validations/format.rb
@@ -3,9 +3,9 @@ module ActiveModel
class FormatValidator < EachValidator
def validate_each(record, attribute, value)
if options[:with] && value.to_s !~ options[:with]
- record.errors.add(attribute, :invalid, :default => options[:message], :value => value)
+ record.errors.add(attribute, :invalid, options.merge(:value => value))
elsif options[:without] && value.to_s =~ options[:without]
- record.errors.add(attribute, :invalid, :default => options[:message], :value => value)
+ record.errors.add(attribute, :invalid, options.merge(:value => value))
end
end