mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 07:39:39 +02:00
Refactor: Use native error i18n lookup (#1076)
This commit is contained in:
parent
150fce41a8
commit
14c4b9e93c
15 changed files with 103 additions and 26 deletions
|
@ -55,7 +55,8 @@ class User < ApplicationRecord
|
|||
|
||||
def can_deactivate
|
||||
if admin? && family.users.count > 1
|
||||
errors.add(:base, I18n.t("activerecord.errors.user.cannot_deactivate_admin_with_other_users"))
|
||||
# i18n-tasks-use t('activerecord.errors.models.user.attributes.base.cannot_deactivate_admin_with_other_users')
|
||||
errors.add(:base, :cannot_deactivate_admin_with_other_users)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -83,7 +84,8 @@ class User < ApplicationRecord
|
|||
|
||||
def profile_image_size
|
||||
if profile_image.attached? && profile_image.byte_size > 5.megabytes
|
||||
errors.add(:profile_image, "is too large. Maximum size is 5 MB.")
|
||||
# i18n-tasks-use t('activerecord.errors.models.user.attributes.profile_image.invalid_file_size')
|
||||
errors.add(:profile_image, :invalid_file_size, max_megabytes: 5)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue