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

Fix scaffold controller generator with namespace #512

Merged
merged 4 commits into from
Dec 16, 2021

Conversation

ceritium
Copy link
Contributor

@ceritium ceritium commented Nov 8, 2021

For example:

bundle exec rails g scaffold_controller Admin::Post title:string content:text --model-name=Post

It fixes the code generated by jbuilder. There is another fix on railties gem.

You can QA it modifying the Gemfile with:

gem "rails", github: "ceritium/rails", branch: "fix-scaffold-generator"
gem 'jbuilder', github: "ceritium/jbuilder", branch: "fix-scaffold-controller-namespace"

And run the following generators for example:

bundle exec rails g model title:string content:text
bundle exec rails g scaffold_controller Admin::Post title:string content:text --model-name=Post
rake test # or just run the generated tests

Then you can see the code and test the generated scaffold.

@ceritium ceritium force-pushed the fix-scaffold-controller-namespace branch from 1e80e6a to 71fdf4a Compare November 8, 2021 18:56
@ceritium ceritium marked this pull request as ready for review November 9, 2021 13:14
@ceritium ceritium changed the title Fix scaffold controller when namespace Fix scaffold controller with namespace Nov 9, 2021
@ceritium ceritium force-pushed the fix-scaffold-controller-namespace branch from 3d443bf to 00c99b0 Compare November 9, 2021 13:58
@ceritium ceritium changed the title Fix scaffold controller with namespace Fix scaffold controller generator with namespace Nov 9, 2021
For example:

```
bundle exec rails g scaffold_controller Admin::Post title:string content:text --model-name=Post
```

It fixes the code generated by jbuilder, other changes are required on
railties gem.
Only for Rails::VERSION::MAJOR >= 6 because the method `show_helper`
doesn't handle well the namespaces on previous versions.
@ceritium ceritium force-pushed the fix-scaffold-controller-namespace branch from 00c99b0 to 56d333b Compare November 9, 2021 21:01
@dhh dhh merged commit 496a2f9 into rails:master Dec 16, 2021
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 this pull request may close these issues.

2 participants