dougal / acts_as_indexed

Acts As Indexed is a plugin which provides a pain-free way to add fulltext search to your Ruby on Rails app
http://douglasfshearer.com/blog/rails-plugin-acts_as_indexed
MIT License
211 stars 49 forks source link

error "ArgumentError: undefined class/module Foo" #3

Closed Florent2 closed 14 years ago

Florent2 commented 14 years ago

Hi,

I use the plugin version of acts_as_indexed in my Rails 2.3.4 application. I had installed the plugin in July 2009 and it was working fine.

I've updated the plugin with the latest version available in the github repository (to see if it fixes the issue http://github.com/dougal/acts_as_indexed/issues#issue/2), but now when I try to use the with_index scope to search existing data in my application I get the following error. Looks like it occurs on the Marshal loading (http://github.com/dougal/acts_as_indexed/blob/master/lib/acts_as_indexed/search_index.rb#L353)

I've tried to use it in a new freshly created Rails 2.3.4 application and I get no problem, it is working as expected.

The error:

Product.with_query "aproducname" Query not in cache, running search. atom_file = #Pathname:/myproject/index/development/Product/122_111_101 ArgumentError: undefined class/module Foo:: from /myproject/vendor/plugins/acts_as_indexed/lib/acts_as_indexed/search_index.rb:354:in load' from /myproject/vendor/plugins/acts_as_indexed/lib/acts_as_indexed/search_index.rb:354:inload_atoms' from /usr/local/lib/ruby/1.8/pathname.rb:798:in open' from /usr/local/lib/ruby/1.8/pathname.rb:798:inopen' from /myproject/vendor/plugins/acts_as_indexed/lib/acts_as_indexed/search_index.rb:353:in load_atoms' from /myproject/vendor/plugins/acts_as_indexed/lib/acts_as_indexed/search_index.rb:351:ineach' from /myproject/vendor/plugins/acts_as_indexed/lib/acts_as_indexed/search_index.rb:351:in load_atoms' from /myproject/vendor/plugins/acts_as_indexed/lib/acts_as_indexed/search_index.rb:348:ineach' from /myproject/vendor/plugins/acts_as_indexed/lib/acts_as_indexed/search_index.rb:348:in load_atoms' from /myproject/vendor/plugins/acts_as_indexed/lib/acts_as_indexed/search_index.rb:84:insearch' from /myproject/vendor/plugins/acts_as_indexed/lib/acts_as_indexed.rb:144:in search_index' from /myproject/vendor/plugins/acts_as_indexed/lib/acts_as_indexed.rb:74:inacts_as_indexed' from /myproject/vendor/rails/activerecord/lib/active_record/named_scope.rb:92:in call' from /myproject/vendor/rails/activerecord/lib/active_record/named_scope.rb:92:innamed_scope' from /myproject/vendor/rails/activerecord/lib/active_record/named_scope.rb:97:in call' from /myproject/vendor/rails/activerecord/lib/active_record/named_scope.rb:97:inwith_query'

parndt commented 14 years ago

FYI you have to clear out your index directory when upgrading.

Florent2 commented 14 years ago

Thanks Philip. Meanwhile I've switched to another solution. But this is an important indication, I've submitted a patch to add this to the README.