Closed Freubert closed 2 years ago
@Freubert This is intentional; two separate Zeitwerk instances cannot manage the same directory; see: https://github.com/bigcommerce/gruf/blob/main/lib/gruf/integrations/rails/railtie.rb#L29
Allowing Rails to manage autoloading for app/rpc
will cause conflicts in Zeitwerk in non-classic autoloading setups, which will be required in Rails 7+. gruf is aligning to that - it is recommended instead that you not put classes that are not Gruf controllers in app/rpc
, instead placing them in other directories (such as app/models, lib/, etc).
Thanks @splittingred for the clarification.
Please describe the issue
When running Gruf client in a Rails setup the autoload_path
app/rpc
will be removed from the config.How to Reproduce
Steps to reproduce the behavior:
app/rpc
from Rails console in production modeuninitialized constant
error will occurWhat should happen?
app/rpc
shouldn't be removed from autoload_path in client mode.Anything else we should know?
Workaround
A workaround seems to be to add
app/rpc
explicitly to Rails eager_load_path.