我有一个我不想覆盖的非用户友好的验证错误消息:
Cannot delete record because dependent [unfriendly model names] exist
关联所在</ p>
has_many :unfriendly_model_names, dependent: :restrict_with_error
我希望它成为
Cannot delete record because dependent [nice readable model names] exist
我希望可以使用I18n,但是如何以及在什么时候将友好的字符串传递到record
插值中?
en-GB:
activerecord:
errors:
messages:
restrict_dependent_destroy:
has_many: "Cannot delete record because dependent %{record} exist"
答案 0 :(得分:0)
您必须本地化关联属性。因此,如果您要破坏受错误限制的许多user
的{{1}}:
posts