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

Simplify Rails Integration #102

Merged
merged 1 commit into from
Feb 23, 2024

Conversation

zacheryph
Copy link
Contributor

Closes #100

This resolves an issue which currently happens, attempting to load rbexy into a fresh rails application. You get odd constant undefined errors due to trying to find constants in the wrong module.

This was simplified by including all of action_view. We depend on quite a few things from ActionView. Including the main module merely defines autoloads for the library, but does not include anything until requested. This seems to ensure things get loaded in whatever order they need to get loaded in. (apparently the require's within the rails code is... for show?)

This also simplifies Rails integration by auto-loading the engine if we're in the Rails environment. Rails apps explicitly require rails before loading bundled gems (in application.rb), there for we're guaranteed it is defined.

This allows easy inclusion within a Rails application by
auto-loading the engine if Rails is defined. This is a
given as apps require rails before doing Bundler.setup
Copy link
Owner

@patbenatar patbenatar left a comment

Choose a reason for hiding this comment

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

I like it!

@patbenatar patbenatar merged commit 08fc0b1 into patbenatar:master Feb 23, 2024
12 checks passed
@zacheryph zacheryph deleted the fix/rails-load-failure branch February 23, 2024 15:31
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.

Rbexy Fails to Load
2 participants