Skip to content

Fix require_relative path in railtie generators block - #23

Merged
sebscholl merged 1 commit into
zarpay:mainfrom
ashhadsheikh:fix/railtie-generator-require-path
May 5, 2026
Merged

Fix require_relative path in railtie generators block#23
sebscholl merged 1 commit into
zarpay:mainfrom
ashhadsheikh:fix/railtie-generator-require-path

Conversation

@ashhadsheikh

Copy link
Copy Markdown
Contributor

Fixes #22.

The generators do ... end block in Amount::ActiveRecord::Railtie had an extra .. segment in its require_relative, causing all rails generate commands to crash in apps that bundle the gem.

The railtie lives at gem/lib/amount/active_record/railtie.rb. The target file is at gem/lib/generators/amount/active_record/registry_generator.rb — two levels up and across into generators/, not three levels up.

Diff is one character (drop one ..):

-      require_relative "../../../generators/amount/active_record/registry_generator"
+      require_relative "../../generators/amount/active_record/registry_generator"

Verification

Reproduced the LoadError on amounts 0.0.7 in a host Rails 8.1 app via bundle exec rails generate migration FooBar. Patched the railtie in place inside the bundle's gem directory and reran the same command — succeeded, file generated correctly. No other generator paths or app behaviour change.

The generators block went up three directory levels but the target
registry_generator.rb lives only two levels up under lib/generators/.
This caused every `rails generate` command to crash with a LoadError
in apps that bundle the gem.

Fixes zarpay#22.
@ashhadsheikh
ashhadsheikh requested a review from sebscholl May 5, 2026 07:23
@sebscholl
sebscholl merged commit d379a4f into zarpay:main May 5, 2026
9 checks passed
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.

Railtie's generators block fails to load registry_generator (wrong require_relative path)

2 participants