Zeitwerk load error with Rails plugin generator

I want to develop a new plugin with Rails plugin generator

git clone https://github.com/discourse/discourse
rails g plugin discourse-xxx
rails s 

Error msg:

wrong constant name Discourse-xxx inferred by Module from directory (Zeitwerk::NameError)

/Users/project/discourse/plugins/discourse-xxx/app/controllers/discourse-xxx

Possible ways to address this:

  • Tell Zeitwerk to ignore this particular directory.
  • Tell Zeitwerk to ignore one of its parent directories.
  • Rename the directory to comply with the naming conventions.
  • Modify the inflector to handle this case.

However , everything is fine if the plugin name with no “-”

rails g plugin xxx
rails s

2 Likes

Didnt look at it since we did zeitwerk. Will have a look.

6 Likes