activerecord-hackery / meta_search

Object-based searching (and more) for simply creating search forms. Not currently maintained.
http://erniemiller.org/2013/11/17/anyone-interested-in-activerecord-hackery/
MIT License
906 stars 140 forks source link

meta_search breaks thinking_sphinx on Rails 3.1rc1 #33

Closed a-chernykh closed 13 years ago

a-chernykh commented 13 years ago

First of all, thanks for the great gem.

I am getting "Association named 'applications_forums' was not found; perhaps you misspelled it?" errors when trying to reconfigure thinking_sphinx. If meta_search gem has been commented out in Gemfile then configuration process passes without errors.

Stack trace:

https://gist.github.com/1006487

My Gemfile:

gem 'rails', '3.1.0.rc1'
gem 'thinking-sphinx', :git => 'https://github.com/freelancing-god/thinking-sphinx.git', :branch => 'rails3'
gem 'meta_search', :git => 'https://github.com/ernie/meta_search.git'

My models:

class Post < ActiveRecord::Base
  belongs_to :forum

  define_index do
    has forum.applications_forums.application_id
  end
end

class class Forum < ActiveRecord::Base
  has_many :applications_forums
end

class ApplicationsForum < ActiveRecord::Base
  belongs_to :application
  belongs_to :forum
end

Probably, it's an issue of Thinking Sphinx then sorry for bothering you.

ernie commented 13 years ago

Is it still doing this on current versions? I can't imagine why this might be, because metasearch doesn't really mess with associations in any way that might prevent them being found. But then, I've never used Thinking Sphinx as of yet, so I don't know what it might be trying to do.

a-chernykh commented 13 years ago

Unfortunately, I've temporarily given up on this. I'll update this issue when I have a chance to look.

ernie commented 13 years ago

Thanks. Closing for now, please reopen if you run into the issue again and can verify it's not something in the application code.