pat / thinking-sphinx

Sphinx/Manticore plugin for ActiveRecord/Rails
http://freelancing-gods.com/thinking-sphinx
MIT License
1.63k stars 469 forks source link

Undefined method `define_index' with RailsAdmin #366

Closed dsnipe closed 12 years ago

dsnipe commented 12 years ago

I had a very strange bug. In my app i using RailsAdmin as admin interface and Thinking Sphinx. In model Article i have index defenition

class Article < ActiveRecord::Base
 define_index do
   indexes :title
   indexes :body
   indexes :author
 end
end

And rails_admin.rb (init configure file) for configure RailsAdmin. So when i write configurations for model Article, app and rake tasks not run with 'undefined method' error. When i comment this config, everething OK.

RailsAdmin.config do |config|
  config.model Article # if comment this, ts define indexes (no error)
    # some code
  end #
end

I tried to find what is causing the error, but now I have no time to deep in code. Gems: rails_admin (0.0.4) bbenezech-nested_form (~> 0.0.6) bootstrap-sass (~> 2.0, >= 2.0.3) builder (~> 3.0) coffee-rails (~> 3.1) haml (~> 3.1) jquery-rails (>= 1.0.17) jquery-ui-rails (~> 0.2.2) kaminari (~> 0.12) rack-pjax (~> 0.5) rails (~> 3.1) remotipart (~> 1.0) sass-rails (~> 3.1)

thinking-sphinx (2.0.12) activerecord (>= 3.0.3) builder (>= 2.1.2) riddle (>= 1.5.2)

pat commented 12 years ago

My guess is that RailsAdmin's configuration is occurring before Thinking Sphinx is loaded. Is thinking-sphinx above rails_admin in your Gemfile? I'd recommend trying that and see if that fixes the error.

On 26/06/2012, at 9:19 AM, Dmitry wrote:

I had a very strange bug. In my app i using RailsAdmin as admin interface and Thinking Sphinx. In model Article i have index defenition

class Article < ActiveRecord::Base
define_index do
  indexes :title
  indexes :body
  indexes :author
end
end

And rails_admin.rb (init configure file) for configure RailsAdmin. So when i write configurations for model Article, app and rake tasks not run with 'undefined method' error. When i comment this config, everething OK.

RailsAdmin.config do |config|
 config.model Article # if comment this, ts define indexes (no error)
   # some code
 end #
end

I tried to find what is causing the error, but now I have no time to deep in code. Gems: rails_admin (0.0.4) bbenezech-nested_form (~> 0.0.6) bootstrap-sass (~> 2.0, >= 2.0.3) builder (~> 3.0) coffee-rails (~> 3.1) haml (~> 3.1) jquery-rails (>= 1.0.17) jquery-ui-rails (~> 0.2.2) kaminari (~> 0.12) rack-pjax (~> 0.5) rails (~> 3.1) remotipart (~> 1.0) sass-rails (~> 3.1)

thinking-sphinx (2.0.12) activerecord (>= 3.0.3) builder (>= 2.1.2) riddle (>= 1.5.2)


Reply to this email directly or view it on GitHub: https://github.com/freelancing-god/thinking-sphinx/issues/366

dsnipe commented 12 years ago

I put ts just above rails_admin gem and nothing changed. But when i put thinking-sphinx on top of Gemfile (just after DB driver and rails gems), it worked. Thanks a lot!

pat commented 12 years ago

Great :)

On 28/06/2012, at 9:07 AM, Dmitry wrote:

I put ts just above rails_admin gem and nothing changed. But when i put thinking-sphinx on top of Gemfile (just after DB driver and rails gems), it worked. Thanks a lot!


Reply to this email directly or view it on GitHub: https://github.com/freelancing-god/thinking-sphinx/issues/366#issuecomment-6623968

cec commented 11 years ago

@dsnipe Hi, I'd like to run full-text searches on a model directly from the RA index action for that model. Do you mind sharing the way you used to integrate TS with RA?