-
Notifications
You must be signed in to change notification settings - Fork 252
Open
Description
While built-in model validations are internationalized, several of our custom model validations use English string literals, e.g.
Markus/app/models/admin_role.rb
Lines 4 to 9 in a43f781
| def associated_user_is_an_admin | |
| unless self.user.nil? || self.user.admin_user? | |
| errors.add(:base, 'only admin users can be assigned the admin role') | |
| end | |
| end | |
| end |
We should internationalize all of these strings. We can follow the same structure as the built-in error message scopes, e.g.
en:
activerecord
errors:
models:
admin_role:
associated_user_is_an_admin: "Only admin users..."and then in the model,
def associated_user_is_an_admin
unless self.user.nil? || self.user.admin_user?
errors.add(:base, :associated_user_is_an_admin)
end
endSee also Errors#add.
Metadata
Metadata
Assignees
Labels
No labels