-
Notifications
You must be signed in to change notification settings - Fork 470
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
Rails 6.1.4 throws NameError: uninitialized constant ThinkingSphinx::ActiveRecord when running tasks #1199
Comments
This isn't quite as neat as ea8bc34 (as I like the idea of waiting until ActiveRecord is loaded by Rails itself), but it seems Rake tasks don't always load ActiveRecord, and so we end up in a situation where indices are being loaded without TS's ActiveRecord components being available (see #1199). But: the main issue was that prior to @jdelStrother's good work, AR configuration in initialisers was being ignored. This new approach waits until after initialisers have been run, so it should be fine.
Thanks @jasongorst for reporting this - I've put together a fix that works in my test app, but perhaps you want to bundle from the |
Thanks for the quick fix, @pat!
That seems to have done the trick. Works fine in my test app.
Jason
… On Aug 7, 2021, at 9:18 PM, Pat Allan ***@***.***> wrote:
Thanks @jasongorst <https://github.com/jasongorst> for reporting this - I've put together a fix that works in my test app, but perhaps you want to bundle from the develop branch to confirm it's fine by you? @jdelStrother <https://github.com/jdelStrother> would appreciate your eyes over this too if you have a chance, given it's an evolution of your improvements :) (See ea35340 <ea35340>)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#1199 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAIBLC3FBAIQSGKQXO6HIPLT3XSOLANCNFSM5BWSXLWA>.
Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>.
|
Thanks for that confirmation Jason - I've just published v5.2.1 with the fix :) |
Yeah, think this is OK. It's a shame that it forces ActiveRecord to load for unrelated things like assets:precompile, but in practice it probably doesn't have much noticeable impact, and I don't see a clean alternative. 😕 |
Yeah, it's not as neat as your solution, but I guess this is what we're stuck with. Thanks for the confirmation Jonathan :) |
Rails 6.1.4 with thinking-sphinx 5.2.0 throws a NameError when running tasks.
I created a bare application having just a single model having 2 attributes and an index file, and got the same error on ts:rebuild (or ts:clear or whatever).
The text was updated successfully, but these errors were encountered: