error-messages-for

Rails I18n accepts_nested_attributes_for and error_messages_for

两盒软妹~` 提交于 2019-11-28 06:28:30
I've got two models class SurveyResponse has_many :answers, :class_name => SurveyResponseAnswer.name accepts_nested_attributes_for :answers end class SurveyResponseAnswer belongs_to :survey_response validates_presence_of :answer_text end In my nested form if validation fails I get this error displayed on the screen: "answers answer text can't be blank" I've customized my attribute names somewhat successfully using rails I18n. It doesn't behave exactly how I would expect though. The yml file below doesn't affect how the attribute name is printed in error_messages_for en: activerecord: models:

Rails I18n accepts_nested_attributes_for and error_messages_for

别等时光非礼了梦想. 提交于 2019-11-27 01:21:42
问题 I've got two models class SurveyResponse has_many :answers, :class_name => SurveyResponseAnswer.name accepts_nested_attributes_for :answers end class SurveyResponseAnswer belongs_to :survey_response validates_presence_of :answer_text end In my nested form if validation fails I get this error displayed on the screen: "answers answer text can't be blank" I've customized my attribute names somewhat successfully using rails I18n. It doesn't behave exactly how I would expect though. The yml file