patbenatar / rbexy

A Ruby template language and component framework inspired by JSX and React
MIT License
34 stars 5 forks source link

Simplify Rails Integration #102

Closed zacheryph closed 2 months ago

zacheryph commented 2 months ago

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.