Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect url comment notes in generated scaffold controller in a namespace. #44662

Closed
qichunren opened this issue Mar 11, 2022 · 3 comments · Fixed by #44670
Closed

Incorrect url comment notes in generated scaffold controller in a namespace. #44662

qichunren opened this issue Mar 11, 2022 · 3 comments · Fixed by #44670

Comments

@qichunren
Copy link

qichunren commented Mar 11, 2022

Steps to reproduce

rails new test_blog
cd test_blog
./bin/rails generate model Post title context:text
./bin/rails g scaffold_controller Admin::Post title context:text --model-name=Post

Expected behavior

Every generated url comment note should contain namespace prefix like: # GET /admin/posts or /admin/posts.json

Actual behavior

Every generated url comment note missing namespace prefix like: # GET /posts or /posts.json

System configuration

Rails version: v7.0.2.2

Ruby version: v3.1.0

@pixeltrix
Copy link
Contributor

@qichunren according to the USAGE file, you're meant to use module/class and not module::class, e.g.

bin/rails g scaffold_controller Admin/Post

This generates the correct comments when I test locally.

@qichunren
Copy link
Author

qichunren commented Mar 12, 2022

@pixeltrix I test locally with your way,

./bin/rails g scaffold_controller Admin/Post title context:text --model-name=Post

It still generates incorrect comments as the issue reported.

Did I miss something?

pixeltrix added a commit to pixeltrix/rails that referenced this issue Mar 12, 2022
The `route_url` method now returns the correct path when generating
a namespaced controller with a top-level model using `--model-name`.

Fixes rails#44662.
@pixeltrix
Copy link
Contributor

Did I miss something?

No, I missed adding the --model-name option 😞

I made a PR to fix this: #44670

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants