I have a simple object like:
class Question < ActiveRecord::Base
belongs_to :company
validates :company, presence: true
end
and I can’t get the verification message I18n to use the user model name for the error message.
I saved the key "activerecord.models.company" as "Firma" (German), and when I do Company.model_name.human, it returns "Firma", as expected. But the error message still displays as "Company" until I save "activerecord.attributes.question.company".
This is annoying because I need to add an attribute key for each model that checks connection with the Company (for example, "activerecord.attributes.user.company", "activerecord.attributes.project.company").
Is there a way to refer to the name of a human model instead of an attribute?
source
share