The problem does not lie in your translation dictionaries.Thats why changing it to uppercase in your dictionaries did not work.
Below are the code snippets from the activerecord-5.1.6
handler function for both has_one and has_many associations for your specific error, meaning: restrict_dependent_destroy
.
has_one:
def handle_dependency
case options[:dependent]
when :restrict_with_exception
raise ActiveRecord::DeleteRestrictionError.new(reflection.name) if load_target
when :restrict_with_error
if load_target
record = owner.class.human_attribute_name(reflection.name).downcase
owner.errors.add(:base, :'restrict_dependent_destroy.has_one', record: record)
throw(:abort)
end
else
delete
end
end
has_many:
def handle_dependency
case options[:dependent]
when :restrict_with_exception
raise ActiveRecord::DeleteRestrictionError.new(reflection.name) unless empty?
when :restrict_with_error
unless empty?
record = owner.class.human_attribute_name(reflection.name).downcase
owner.errors.add(:base, :'restrict_dependent_destroy.has_many', record: record)
throw(:abort)
end
when :destroy
# No point in executing the counter update since we're going to destroy the parent anyway
load_target.each { |t| t.destroyed_by_association = reflection }
destroy_all
else
delete_all
end
end
In both cases as you can see the "record" is obtained through the following line:
record = owner.class.human_attribute_name(reflection.name).downcase
You stated that this is your problem.
Override the specific functions I just showed in the snippets and remove the .downcase
call from the end of both of them and its bound to work.
If you do not know how to override gem module methods refer to this question