Skip to content

Commit 0619e49

Browse files
committed
Ensure I18n translations are loaded before storing custom translation
Otherwise, the custom translation may be overwritten when the backend loads translations as part of validation
1 parent 6058aee commit 0619e49

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

test/date_validator_test.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ module Validations
8484

8585
it "allows custom validation message to be handled by I18n" do
8686
custom_message = 'Custom Date Message'
87+
88+
I18n.backend.eager_load! if I18n.backend.respond_to?(:eager_load!)
8789
I18n.backend.store_translations('en', { errors: { messages: { not_a_date: custom_message }}})
8890

8991
TestRecord.validates :expiration_date, date: true

0 commit comments

Comments
 (0)