inertiajs / inertia-rails

The Rails adapter for Inertia.js.

Home Page:https://inertiajs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue using eager_load in external gem

aviemet opened this issue · comments

After upgrading to 1.12.1, a gem I wrote is now throwing an error when it runs. I'm not sure if this is something which might effect others, or if it's a sub-optimal implementation on my part.

In my gem, I use Rails.application.eager_load! so that I can load all ActiveRecord models and do some inspection. With the latest version, that throws the following error:

undefined method 'helper' for ActionController::API:Class

Which traces back to this line on the Controller module in InertiaRails.

I've been searching for a better way to eager load models, but I can't seem to find one. Would appreciate some guidance.

ref #77

Thanks for the report @aviemet and the fix @0xDing ! This change is going to require us to drop support for an older version of Rails so I think it seems appropriate to do a major version bump. I'll get that done this weekend!

Just tagged Inertia v2.0. Please take a look and see if this resolves your issues!

Feel free to re-open if it does not.