Scaffolding with case sensitivity causes issues.
When I use case sensitivity in my scaffolding, I get errors when trying to access the respective pages (new, show, and edit). To recreate these issues, I did the following:
-
compound init blah --db mongodb && cd blah -
npm install -
compound g s testBlah id:int name:string
The errors say testblah is not defined, so I figured it had something to do with case sensitivity, so I did some poking around. To get the app working, I made these changes:
app/views/testblahs/_form.ejs
Line 1, errorMessagesFor(testblah) should be errorMessagesFor(testBlah).
app/views/testblahs/new.ejs
Line 11, formFor(testblah, ... should be formFor(testBlah, ....
app/views/testblahs/edit.ejs
Line 11, formFor(testblah, ... should be formFor(testBlah, ... and pathTo.testblah(testblah)... should be pathTo.testblah(testBlah)...
Line 16, pathTo.testblah(testblah)... should be pathTo.testblah(testBlah)...
app/views/testblahs/show.ejs
Line 13, testblah.id should be testBlah.id
Line 15, testblah.name should be testBlah.name
Line 20, pathTo.edit_testblah(testblah)... should be pathTo.edit_testblah(testBlah)...
Line 21, pathTo.testblah(testblah)... should be pathTo.testblah(testBlah)...
That solves the issue of showing the pages, however, testing is another issue. I get 6 initial errors when running the test... they are as follows:
- TestblahController should access Testblah#find and render "edit" template on GET /testblahs/:id/edit:
TypeError: Cannot set property 'find' of undefined 2. TestblahController should access Testblah#find and render "show" template on GET /testblahs/:id :
TypeError: Cannot set property 'find' of undefined 3. TestblahController should access Testblah#create on POST /testblahs with a valid Testblah:
TypeError: Cannot set property 'create' of undefined 4. TestblahController should fail on POST /testblahs when Testblah#create returns an error:
TypeError: Cannot set property 'create' of undefined 5. TestblahController should redirect on PUT /testblahs/:id with a valid Testblah:
TypeError: Cannot set property 'find' of undefined 6. TestblahController should fail / not redirect on PUT /testblahs/:id with an invalid Testblah:
TypeError: Cannot set property 'find' of undefined
I can get rid of 1, 2, and 6 by changing all occurrences of app.models.Testblah to app.models.TestBlah. However, I'm a bit unsure how to fix the other 3. If I had done compound g s testblah id:int name:string, all pages and testing are kosher, so clearly the case is messing up the rest of the testing elsewhere... I just can't figure it out. Either way, I figured this was a bug and should be reported.
Let me know if you need any further information.