You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create model choice_question_option with field called text. We want to customize the human readable name and error message when :taken validation (uniqueness) fails. Setup a simple validation for uniqueness on text. Try to add a new model with the same text as an old model. Examine error messages produced on the errors field.
Expected behavior
Overriding text in a YAML should only require the singular table name in both cases.
According to both Rails docs, singular model names should be used (this is also mirrored in comments in the ActiveRecord code). That would mean a yaml file like:
en:
activerecord:
attributes:
choice_question_option:
text: "Super question"
errors:
models:
choice_question_option:
attributes:
text:
taken: "is already used by another question."
Actual behavior
However, this does not work. The plurality is inconsistent. I found only the following function as expected:
en:
activerecord:
attributes:
choice_question_options: # note plural model name here
text: "Super question"
errors:
models:
choice_question_option:
attributes:
text:
taken: "is already used by another question."
System configuration
Rails version:
5.0.0.1 Ruby version:
2.3.1p112
The text was updated successfully, but these errors were encountered:
Hi @johnwhelchel! Using this reproduction script, I am not able to reproduce the error you are seeing. Please feel free to edit/modify my script as you see fit (or use a base executable test script template, which are found here, that would demonstrate the problem you are seeing.
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails team are limited, and so we are asking for your help.
If you can still reproduce this error on the 5-1-stable branch or on master, please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions.
Steps to reproduce
Create model
choice_question_option
with field calledtext
. We want to customize the human readable name and error message when:taken
validation (uniqueness) fails. Setup a simple validation for uniqueness on text. Try to add a new model with the same text as an old model. Examine error messages produced on the errors field.Expected behavior
Overriding text in a YAML should only require the singular table name in both cases.
According to both Rails docs, singular model names should be used (this is also mirrored in comments in the ActiveRecord code). That would mean a yaml file like:
Actual behavior
However, this does not work. The plurality is inconsistent. I found only the following function as expected:
System configuration
Rails version:
5.0.0.1
Ruby version:
2.3.1p112
The text was updated successfully, but these errors were encountered: