mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-22 22:06:45 +00:00
fix matcher error_message_for when i18n is loaded and custom error message to use regular string interpolation
This commit is contained in:
parent
011ea070db
commit
9f1642c730
@ -124,7 +124,7 @@ module Spec
|
|||||||
restriction.map! {|r| @validator.send(:type_cast_value, r) }
|
restriction.map! {|r| @validator.send(:type_cast_value, r) }
|
||||||
interpolate = @validator.send(:interpolation_values, option, restriction )
|
interpolate = @validator.send(:interpolation_values, option, restriction )
|
||||||
# get I18n message if defined and has interpolation keys in msg
|
# get I18n message if defined and has interpolation keys in msg
|
||||||
if defined?(I18n) && msg.match(/\{\{/)
|
if defined?(I18n) && !@validator.send(:custom_error_messages).include?(option)
|
||||||
msg = @record.errors.generate_message(@expected, option, interpolate)
|
msg = @record.errors.generate_message(@expected, option, interpolate)
|
||||||
else
|
else
|
||||||
msg = msg % interpolate
|
msg = msg % interpolate
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user