Commit 0dfcf8a
committed
SolidusAdmin: Configure generator namespace early in generator
A previous solution for this bug tried to set the generator namespace in
an app initializer, but that required `rails/generators/base` to be
required - which it is not always when starting up e.g. a server.
I've tried to dig a bit into how this `mattr_accessor :namespace` on
`Rails::Generators::Base` is supposed to be used. It seems like it is
run when loading an engine's generators here[1], but that does not work
in this context.
I don't fully understand how Rails::Generators.namespace is supposed to
be set, but this at least sets it only when needed. There's probably
some magic that we could invoke, but I can't find it documented
anywhere.
[1] https://github.com/rails/rails/blob/main/railties/lib/rails/command/actions.rb#L381 parent e5ed0ff commit 0dfcf8a
File tree
1 file changed
+4
-0
lines changed- admin/lib/generators/solidus_admin/component
1 file changed
+4
-0
lines changedLines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| |||
0 commit comments