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
In a new or existing rails app, invoke the scaffold generator with a model name that starts with a vowel sound
~$ rails generate scaffold Author
Expected behavior
Rails will handle the vast majority of linguistic inflections out of the box. When you run
~$ rails generate scaffold Author
The expected resulting file for a model that begins with a vowel sound is:
# test/system/authors_test.rb# rest of test class test"creating an Author"do# body omittedendtest"updating an Author"do# body omittedendtest"destroying an Author"do# body omittedend
Or some sort of name that doesn't have indefinite article agreement issues:
# test/system/authors_test.rb# rest of test classtest"creating my Author"do# won't be dependent on beginning vowel sound# body omittedendtest"updating my Author"do# body omittedendtest"destroying my Author"do# body omittedend
Actual behavior
# test/system/authors_test.rb# rest of test class test"creating a Author"do# body omittedendtest"updating a Author"do# body omittedendtest"destroying a Author"do# body omittedend
Fix
The quick solution
Change the generator template to reword the generated test so that it doesn't use the indefinite article. I am attaching a PR that changes "a" to "my" in the template generator.
The comprehensive solution
Add inflection of the indefinite article into ActiveSupport. I'm creating a feature proposal to do that on the Rails mailing list here
System configuration
Rails version: Master, but present in 6.0.x and in every release that incorporates commit d502cd1
Ruby version: 2.7.1
The text was updated successfully, but these errors were encountered:
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 6-1-stable branch or on main, please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions.
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 6-1-stable branch or on main, 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
In a new or existing rails app, invoke the scaffold generator with a model name that starts with a vowel sound
~$ rails generate scaffold Author
Expected behavior
Rails will handle the vast majority of linguistic inflections out of the box. When you run
~$ rails generate scaffold Author
The expected resulting file for a model that begins with a vowel sound is:
Or some sort of name that doesn't have indefinite article agreement issues:
Actual behavior
Fix
The quick solution
Change the generator template to reword the generated test so that it doesn't use the indefinite article. I am attaching a PR that changes "a" to "my" in the template generator.
The comprehensive solution
Add inflection of the indefinite article into ActiveSupport. I'm creating a feature proposal to do that on the Rails mailing list here
System configuration
Rails version: Master, but present in 6.0.x and in every release that incorporates commit d502cd1
Ruby version: 2.7.1
The text was updated successfully, but these errors were encountered: