ThinkingSphinx: error loading /path/to/no/active/record/class
Hello Pat,
Is there any problem with me loading TS to a class which is not a model, it is just class, maybe missing some require '
This is not an issue per se, I'm just receiving a warning every time I load my Rails.
Thanks
Hi Augusto
Which version of Thinking Sphinx are you using?
In versions 1 and 2, Thinking Sphinx has to load all files in app/models to determine which ones are ActiveRecord models with index definitions. This is ugly, and Thinking Sphinx v3 behaves far more intelligently, because indices are now defined in their own files in app/indices.
However, if you're using v1/v2, then there's nothing that can be changed to stop this behaviour I'm afraid - but perhaps it's worth upgrading to v3 if you're using Rails 3.1 or newer? If you wish to do that, make sure you have a read of the README to be aware of the changes: https://github.com/pat/thinking-sphinx/blob/master/README.textile
The main documentation isn't updated for TS v3 yet, though I'm working on some ways on how to do that while still maintaining v1/v2 docs (and the corresponding changes in various delta and flying-sphinx libraries).
Hello Pat,
Sorry for been such a moron for not answer your questions earlier, I've been super busy and I'm a huge fan of your work.
I'm currently using Rails 3.0 with TS 2.0.14.
This error was driving me crazy because I use a LOT of cronjobs and if nothing is processed I still getting the email, so I fixed the error crawling through your code and commenting the line when you print the error:
class ThinkingSphinx::Context
def load_models
end
end
I promise I will work to move to Rails 3.2, the problem is that I having tons of traffic in my site and I'm afraid that my time per request can go up because rails if getting slower and slower. If there any tip you can give me about this it will very appreciated.
Just want to comment this if anyone having the same problem.
Thanks man.
Hi Augusto
If you want to stick with TS v2, you can use the indexed_models setting to explicitly state which models to load index definitions from - this will stop TS from scanning through all model files. In config/sphinx.yml under each environment (or just the ones you wish), specify each model name that has an index:
production:
indexed_models:
- Article
- Page
- User
That's awesome Pat, thanks, will implemented right away.
On Sun, Apr 28, 2013 at 2:23 PM, Pat Allan [email protected] wrote:
Hi Augusto
If you want to stick with TS v2, you can use the indexed_models setting to explicitly state which models to load index definitions from - this will stop TS from scanning through all model files. In config/sphinx.ymlunder each environment (or just the ones you wish), specify each model name that has an index:
production: indexed_models: - Article - Page - User
— Reply to this email directly or view it on GitHubhttps://github.com/pat/thinking-sphinx/issues/483#issuecomment-17139628 .
Augusto Ruibal
A quick tip for this if anyone else runs into it (this issue has great Google juice) and wants to find out why it can't be loaded. Open up your local gems folder, open the thinking_sphinx/context.rb file and the line that emits the warning STDERR.puts "ThinkingSphinx: error loading #{file}" and just put raise on a new line before the next call and you'll get the backtrace you always wanted.