TypeError when implementing namespace
- Dominant language
- JavaScript
- Stars
- 1.6k
- Forks
- 179
- PR merge metrics
- No merged PRs in 30d
Description
It would be awesome to be able to `compound g crud "admin/posts" stuff`. Since #93 is closed I assumed it was implemented, but apparently it's not.
When I try to implement a namespace manually, after running `compound g crud post title content` and moving post controllers and views to admin/posts, I get the following error:
> TypeError: /Users/andreashultgren/Documents/Projects/Private/compound-test/app/views/admin/posts/index.ejs:3 1|
5| 6|With the following in routes (according to the docs):
``` javascript
map.namespace('admin', function (admin) {
admin.resources('posts');
});
```
pathTo is not mentioned in the docs.
Some tests covering namespaces would have helped me to figure out what's wrong, but I can't find any of those either.
Is there an example with namespace actually implemented somewhere?
Contributor guide
No contributing guide indexed for this repository
Research direction
The error occurs in app/views/admin/posts/index.ejs where pathTo.posts() is called. Check how routes are defined with map.namespace in routes.js and how pathTo helpers are generated. Look for existing route helper generation code, possibly in lib/compound or lib/compound/helpers. Verify if namespace routes create helpers like pathTo.adminPosts(). Run the app to reproduce the error and see what helpers are available in the view context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- backend, documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100