graphoid icon indicating copy to clipboard operation
graphoid copied to clipboard

Alternative to eager loading?

Open jgrau opened this issue 5 years ago • 3 comments

Hi. First of all thanks for this gem. I'm trying to incorporate it into an existing rails 5.2 application but run into some weird/fun loading issues. In various initializers I have pieces of code that is required for my application to boot. For example I define a class that the application code uses etc. When I install graphoid by adding the gem to the bundle and creating the initializer as per the instructions, I would get errors for example for this missing class. If I rename config/initializers/graphoid.rb to config/initializers/zz_graphoid.rb (so it is the last initializer to run), booting the app works as expected.

From looking at the sourcecode of the gem I suspect it's because it asks rails to eager_load. I could be wrong :)

Is there an alternative approach? Relying on the load order seems a little brittle... :)

jgrau avatar Oct 10 '19 21:10 jgrau