Circular dependency detected while autoloading constant

191 views
Skip to first unread message

Sjors Provoost

unread,
Mar 11, 2014, 5:37:35 PM3/11/14
to thinkin...@googlegroups.com
I'm trying to upgrade to Thinking Sphinx 3.1, but keep running into a mysterious error on my Mac. 

I have a trivial model UserAgent with no dependencies and no code in it:

class UserAgent < ActiveRecord::Base
end

indices/user_agent.rb:

ThinkingSphinx::Index.define :user_agent, :with => :active_record do
  indexes :name
end

I get the following error when running the index task:

rake ts:index

Generating configuration to /Users/sjors/dev/colligative/config/development.sphinx.conf

rake aborted!

Circular dependency detected while autoloading constant UserAgent


I put a more detailed output as well as my Gemfile and sphinx.yml in this gist: https://gist.github.com/Sjors/d53c8a94c8599ebfe22e


Running Ruby 2.1.0, Rails 4.0.3 (also tried 4.0.0), thinking-sphinx 3.1.0 and a Postgres database.

Pat Allan

unread,
Mar 11, 2014, 6:22:28 PM3/11/14
to thinkin...@googlegroups.com
Hi Sjors

What happens in a rails console when you refer to the model (by just entering UserAgent)?

— 
Pat

--
You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thinking-sphi...@googlegroups.com.
To post to this group, send email to thinkin...@googlegroups.com.
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/d/optout.

Sjors Provoost

unread,
Mar 24, 2014, 9:19:53 AM3/24/14
to thinkin...@googlegroups.com
Hi Pat,

Sorry I missed your response... 

When I type "UserAgent" in the console I get the following error:

2.1.0p0 :001 > UserAgent

RuntimeError: Circular dependency detected while autoloading constant UserAgent


When I type "UserAgent.count" in the console I get a different error:

2.1.0p0 :001 > UserAgent.count

LoadError: Unable to autoload constant UserAgent, expected .../app/indices/user_agent.rb to define it


Sjors

Op dinsdag 11 maart 2014 23:22:28 UTC+1 schreef Pat Allan:

Pat Allan

unread,
Mar 24, 2014, 7:21:43 PM3/24/14
to thinkin...@googlegroups.com
Ah. Try renaming app/indices/user_agent.rb to app/indices/user_agent_index.rb

Sjors Provoost

unread,
Mar 26, 2014, 12:24:37 PM3/26/14
to thinkin...@googlegroups.com
Thanks, that did the trick!


--
You received this message because you are subscribed to a topic in the Google Groups "Thinking Sphinx" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/thinking-sphinx/z-JcvYkHy_Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to thinking-sphi...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages