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

Zeitwerk autoload fixes #1709

Merged
merged 3 commits into from
Dec 24, 2023
Merged

Zeitwerk autoload fixes #1709

merged 3 commits into from
Dec 24, 2023

Conversation

mrhardikjoshi
Copy link
Member

Fixes #1702

Problem:

  1. From Rails application (which uses active_graph but do not explicitly load(require)it ) the neo4j-ruby-driver and other dependacies of active_graph are not loaded. So starting rails environment (by rails s , rails c or any of the rake task) results in uninitialized constant error of that dependancy.

  2. generating new rails application using rails new myapp -m activegraph.rb was creating incorrect gemfile.

Solution:

  1. Updated railtie.rb to require active_graph gem. The zeitwerk within active_graph will take care of loading all depending files and gems.

  2. fixed the template which generated gemfile to use correct operator.

@@ -1,6 +1,6 @@
# Usage: rails new myapp -m activegraph.rb

gem 'activegraph', '=> 11.1'
gem 'activegraph', '>= 11.1'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generated fresh rails application before and after this change to compare exact file difference after this change, here is its diff

@klobuczek klobuczek merged commit 4ffc7f1 into zeitwerk Dec 24, 2023
@klobuczek klobuczek deleted the zeitwerk_autoload_fixes branch December 24, 2023 16:27
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