1602 / 1602/compound

Not defined error is encountered when scaffold is camel-cased

オープン
#620 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
1.6k
フォーク
179
PR マージ指標
30日以内にマージされた PR はありません

説明

I scaffolded using the following command:

`compound g scaffold businessUser propertyOne propertyTwo`

and the following error appeared:

```
businessUser is not defined
at eval (:29:423)
at eval (:31:348)
at /Users/carlo/Documents/code/test-node/node_modules/ejs/lib/ejs.js:255:15
at Object.exports.render (/Users/carlo/Documents/code/test-node/node_modules/ejs/lib/ejs.js:293:13)
at View.exports.renderFile [as engine] (/Users/carlo/Documents/code/test-node/node_modules/ejs/lib/ejs.js:323:20)
at View.render (/Users/carlo/Documents/code/test-node/node_modules/express/lib/view.js:76:8)
at Function.app.render (/Users/carlo/Documents/code/test-node/node_modules/express/lib/application.js:504:10)
at ServerResponse.res.render (/Users/carlo/Documents/code/test-node/node_modules/express/lib/response.js:798:7)
at Controller.renderView (/Users/carlo/Documents/code/test-node/node_modules/compound/lib/controller-extensions.js:156:18)
at Controller.render (/Users/carlo/Documents/code/test-node/node_modules/compound/lib/controller-extensions.js:81:10)
at Object._this (:28:12)
at Array.2 (/Users/carlo/Documents/code/test-node/node_modules/compound/node_modules/kontroller/lib/flow-control.js:157:28)
at ActionContext.run [as innerNext] (/Users/carlo/Documents/code/test-node/node_modules/compound/node_modules/kontroller/lib/flow-control.js:109:31)
at Controller.BaseController.next (/Users/carlo/Documents/code/test-node/node_modules/compound/node_modules/kontroller/lib/base.js:107:22)
at Controller.protectFromForgery (/Users/carlo/Documents/code/test-node/node_modules/compound/node_modules/kontroller/lib/helpers.js:95:14)
at Object.eval (:4:12)
at Array.1 (/Users/carlo/Documents/code/test-node/node_modules/compound/node_modules/kontroller/lib/flow-control.js:157:28)
at run (/Users/carlo/Documents/code/test-node/node_modules/compound/node_modules/kontroller/lib/flow-control.js:109:31)
at Array.0 (/Users/carlo/Documents/code/test-node/node_modules/compound/node_modules/kontroller/lib/flow-control.js:60:13)
at run (/Users/carlo/Documents/code/test-node/node_modules/compound/node_modules/kontroller/lib/flow-control.js:109:31)
at compiledAction.(anonymous function) (/Users/carlo/Documents/code/test-node/node_modules/compound/node_modules/kontroller/lib/flow-control.js:91:13)
at Controller.call (/Users/carlo/Documents/code/test-node/node_modules/compound/node_modules/kontroller/lib/flow-control.js:49:16)
at Controller.call (/Users/carlo/Documents/code/test-node/node_modules/compound/node_modules/kontroller/lib/flow-control.js:94:14)
at Controller.perform (/Users/carlo/Documents/code/test-node/node_modules/compound/node_modules/kontroller/lib/flow-control.js:18:10)
at ControllerBridge.callControllerAction (/Users/carlo/Documents/code/test-node/node_modules/compound/lib/controller-bridge.js:169:9)
at ControllerBridge. (/Users/carlo/Documents/code/test-node/node_modules/compound/lib/controller-bridge.js:149:14)
at callbacks (/Users/carlo/Documents/code/test-node/node_modules/express/lib/router/index.js:164:37)
at param (/Users/carlo/Documents/code/test-node/node_modules/express/lib/router/index.js:138:11)
at param (/Users/carlo/Documents/code/test-node/node_modules/express/lib/router/index.js:135:11)
at pass (/Users/carlo/Documents/code/test-node/node_modules/express/lib/router/index.js:145:5)
at Router._dispatch (/Users/carlo/Documents/code/test-node/node_modules/express/lib/router/index.js:173:5)
at Object.router (/Users/carlo/Documents/code/test-node/node_modules/express/lib/router/index.js:33:10)
at next (/Users/carlo/Documents/code/test-node/node_modules/express/node_modules/connect/lib/proto.js:193:15)
at Object.methodOverride [as handle] (/Users/carlo/Documents/code/test-node/node_modules/express/node_modules/connect/node_modules/method-override/index.js:48:5)
at next (/Users/carlo/Documents/code/test-node/node_modules/express/node_modules/connect/lib/proto.js:193:15)
at /Users/carlo/Documents/code/test-node/node_modules/express/node_modules/connect/node_modules/express-session/index.js:350:9
at Object._onImmediate (/Users/carlo/Documents/code/test-node/node_modules/express/node_modules/connect/node_modules/express-session/session/memory.js:50:9)
at processImmediate [as _immediateCallback] (timers.js:330:15)
```

I suspect the camel-case does not go well with scaffolding.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Look at the scaffold generator code, likely in a generators or scaffolding directory. The error mentions EJS rendering, so check template files that handle model names. The issue is with camel-cased model names like 'businessUser' not being defined in the template context. Start by running the scaffold command locally to reproduce, then trace where the model name variable is passed to the template.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
express, javascript, nodejs
領域
backend, cli
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。