buffalo: Buffalo g r people generates invalid names

It seems that Buffalo resources generator is not using correct naming in some cases when using irregular plurals as people like:

$ buffalo g r people first_name:string last_name:string email:string identification:string

it:

  • Uses Persons as the plural in person.go model.
  • Auto renderer looks for templates/persons/*.html template instead of templates/people/*.html

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (15 by maintainers)

Most upvoted comments

Before generating, locate inflections.json in the root of your buffalo app and add the preferred naming like so:

{ "singular": "plural", "person": "people" }

buffalo build && buffalo test

The generate command will now respect the irregular naming convention as defined in the inflections doc. Pertinent output from my test run:

create templates/people/show.html run buffalo db g model person first_name:string last_name:string email:string identification:string create models/person.go create models/person_test.go