fix admin component generator namespace #6237
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is sponsored by 🌋 MagmaLabs
Summary
Admin component generator is failing on a clean solidus installation.
Error comes from https://github.com/rails/rails/blob/3235827585d87661942c91bc81f64f56d710f0b2/railties/lib/rails/generators/base.rb#L321 due to
namespace
is returningnil
.This method was called from
component.rb
templatehttps://github.com/solidusio/solidus/blob/main/admin/lib/generators/solidus_admin/component/templates/component.rb.tt#L3
https://github.com/rails/rails/blob/3235827585d87661942c91bc81f64f56d710f0b2/railties/lib/rails/generators/base.rb#L324
So we need to define namespace into gem or host app to fix it. For now, I think would be easier to fix by adding into initializer template.
Let me know what you think?
Looking into specs found that are passing because we already seated namespace for generators specs
https://github.com/solidusio/solidus/blob/main/admin/spec/spec_helper.rb#L115
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: