Rails doesn't use human name for error message
in my translation file
activerecord:
models:
subject_choice: "Subject Choice"
subject_preference: "Subject Preference"
art_subject_choice: "Group 1 Preference"
science_subject_choice: "Group 2 Preference"
attributes:
student:
in_class: "Class"
subject_pr开发者_开发技巧efernce:
math_preference_type:
m1: "M1"
m2: "M2"
m1_m2: "M1>M2"
m2_m1: "M2>M1"
subject:
subject_type:
science: "Science"
art: "Art"
elective: "Elective"
the validation is done in subject_preference model. but the error show on page is "Subject preference base Art priority cannot be same as science priority."
How can I make it display model name correctly?
UPDATE: I just want to get rid of "Subject preference base", how can i do it? Thanks
errors[:base] << "Duplicated priority in science subject"
I tried a different approach, for example
en:
activerecord:
models:
message:
attributes:
message:
content: ""
subject: ""
and in my model:
validates :subject, :presence => { :message => I18n.t('validation.category')}
This approach ensures only the validation message itself is shown.
精彩评论