Hi Dan

I'm not sure, but I think it could be related to the naming - does Rails 
automatically load abe.rb and expect it to define ABE? Or Abe? I'd expect the 
latter, and that could be why TS is getting a little confused. Good to know you 
got the workaround figured out though.

-- 
Pat

On 13/02/2012, at 11:57 PM, dkam wrote:

> Looks like I can work around this by adding the following to config/
> sphinx.conf
> 
>  indexed_models:
>    - Product
>    - Work
> 
> But it looks like there may be some issue with automatically
> determining which models have indexes defined?
> 
> Cheers,
> Dan
> 
> On Feb 13, 8:56 pm, dkam <[email protected]> wrote:
>> Hello there,
>> 
>> I'm trying to get Thinking Sphinx working with my Rails 3.1 app (on
>> Ruby 1.9.2-p290).
>> 
>> I get the error below when starting the console in production - but
>> not in development.   I have no indexes defined for the models with an
>> error (ABE or shop).
>> 
>> Class structure is:
>> 
>> class Shop < ActiveRecord::Base
>> ....
>> end
>> 
>> Then many subclasses such as:
>> 
>> class ABE < Shop
>> ...
>> end
>> 
>> When there's an index defined, such as:
>> 
>> class Product < ActiveRecord::Base
>> ...
>>  define_index do
>>     indexes title
>>     indexes author
>>     indexes gtin
>>   end
>> ...
>> end
>> 
>> I get the following errors in the console:
>> 
>> user@host /home/user/booko $ bundle exec rails c
>> Warning: Error loading /var/www/booko.com.au/booko/app/models/shops/
>> ABE.rb:
>> uninitialized constant Shops::ABE
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> activesupport-3.1.3/lib/active_support/inflector/methods.rb:124:in
>> `block in constantize'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> activesupport-3.1.3/lib/active_support/inflector/methods.rb:123:in
>> `each'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> activesupport-3.1.3/lib/active_support/inflector/methods.rb:123:in
>> `constantize'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> activesupport-3.1.3/lib/active_support/core_ext/string/inflections.rb:
>> 43:in `constantize'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> thinking-sphinx-2.0.11/lib/thinking_sphinx/context.rb:64:in `block (2
>> levels) in load_models'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> thinking-sphinx-2.0.11/lib/thinking_sphinx/context.rb:54:in `each'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> thinking-sphinx-2.0.11/lib/thinking_sphinx/context.rb:54:in `block in
>> load_models'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> thinking-sphinx-2.0.11/lib/thinking_sphinx/context.rb:53:in `each'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> thinking-sphinx-2.0.11/lib/thinking_sphinx/context.rb:53:in
>> `load_models'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> thinking-sphinx-2.0.11/lib/thinking_sphinx/context.rb:15:in `prepare'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> thinking-sphinx-2.0.11/lib/thinking_sphinx.rb:81:in `block in context'
>> <internal:prelude>:10:in `synchronize'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> thinking-sphinx-2.0.11/lib/thinking_sphinx.rb:78:in `context'
>> /home/dkam/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> thinking-sphinx-2.0.11/lib/thinking_sphinx/active_record.rb:162:in
>> `define_index'
>> /var/www/booko.com.au/booko/app/models/product.rb:22:in
>> `<class:Product>'
>> /var/www/booko.com.au/booko/app/models/product.rb:1:in `<top
>> (required)>'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> railties-3.1.3/lib/rails/engine.rb:417:in `block (2 levels) in
>> eager_load!'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> railties-3.1.3/lib/rails/engine.rb:416:in `each'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> railties-3.1.3/lib/rails/engine.rb:416:in `block in eager_load!'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> railties-3.1.3/lib/rails/engine.rb:414:in `each'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> railties-3.1.3/lib/rails/engine.rb:414:in `eager_load!'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> railties-3.1.3/lib/rails/application/finisher.rb:51:in `block in
>> <module:Finisher>'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> railties-3.1.3/lib/rails/initializable.rb:30:in `instance_exec'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> railties-3.1.3/lib/rails/initializable.rb:30:in `run'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> railties-3.1.3/lib/rails/initializable.rb:55:in `block in
>> run_initializers'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> railties-3.1.3/lib/rails/initializable.rb:54:in `each'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> railties-3.1.3/lib/rails/initializable.rb:54:in `run_initializers'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> railties-3.1.3/lib/rails/application.rb:96:in `initialize!'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> railties-3.1.3/lib/rails/railtie/configurable.rb:30:in
>> `method_missing'
>> /var/www/booko.com.au/booko/config/environment.rb:5:in `<top
>> (required)>'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> railties-3.1.3/lib/rails/application.rb:83:in `require_environment!'
>> /home/user/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/
>> railties-3.1.3/lib/rails/commands.rb:39:in `<top (required)>'
>> script/rails:6:in `require'
>> script/rails:6:in `<main>'
>> 
>> Any idea what might be causing this?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/thinking-sphinx?hl=en.
> 



-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.

Reply via email to