binarylogic / searchlogic

Searchlogic provides object based searching, common named scopes, and other useful tools.
http://rdoc.info/projects/binarylogic/searchlogic
MIT License
1.4k stars 133 forks source link

2.5 not compatible with thinking-sphinx #143

Open ledermann opened 13 years ago

ledermann commented 13 years ago

Since version 2.5 searchlogic can not be used in apps which uses the gem "ts-delayed_delta" from thinking-sphinx, too. On startup, this error message is raised:

Mysql::Error: Table 'myapp.jobs' doesn't exist: SHOW FIELDS FROM `jobs` (ActiveRecord::StatementInvalid)

It seems there is a bug in searchlogic (since 2.5, 2.4.32 is fine) handling AR models using set_table_name like ts-delayed_delta does: https://github.com/freelancing-god/ts-delayed-delta/blob/master/lib/thinking_sphinx/deltas/delayed_delta/job.rb

ghost commented 13 years ago

I can't reproduce this. set_table_name is working fine for me. Can you tell me what to do to reproduce this? Or better yet, create a failing test that I can fix. Thanks.

ledermann commented 13 years ago

It seems it's an issue with the ordering of gems in the Gemfile: If searchlogic is the last gem defined, it all works fine. But if searchlogic is defined before ts-delayed-delta, the error occurs.

I can not reproduce it within an simple dummy application, perhaps it only occurs if another gem defines an AR model using set_table_name. You are right, it works fine if a model of the application uses set_table_name.

Sorry, I'm not able to create a failing test.

My environment: RubyGems 1.6.2, Bundler 1.0.10, Rails 2.3.11, Ruby 1.8.7-334, OS X

moiristo commented 12 years ago

Probably related to the pull request I just sent: https://github.com/freelancing-god/ts-delayed-delta/pull/14