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

Use controller_class_path in Rails::Generators::NamedBase#route_url #44670

Conversation

pixeltrix
Copy link
Contributor

The route_url method now returns the correct path when generating a namespaced controller with a top-level model using --model-name.

Previously, when running this command:

bin/rails generate scaffold_controller Admin/Post --model-name Post

the comments above the controller action would look like:

# GET /posts
def index
  @posts = Post.all
end

afterwards, they now look like this:

# GET /admin/posts
def index
  @posts = Post.all
end

Fixes #44662.

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.
@rails-bot rails-bot bot added the railties label Mar 12, 2022
@tenderlove tenderlove merged commit 9daee41 into rails:main Mar 14, 2022
rafaelfranca pushed a commit that referenced this pull request Mar 14, 2022
…namespaced-controllers

Use `controller_class_path` in `Rails::Generators::NamedBase#route_url`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect url comment notes in generated scaffold controller in a namespace.
2 participants