To edit pages or tickets please login with username/password: aaf/aaf

Ticket #224 (new defect)

Opened 4 months ago

Last modified 4 months ago

cannot use acts_as_ferret with remote index and single table inheritance

Reported by: aaf Assigned to: jk
Priority: major Milestone:
Component: 0plugin Version:
Keywords: Cc:

Description

Hi,

We're using acts_as_ferret from trunk and my searches crash while in production mode. We hunted it down and discovered that the problem is with acts_as_ferret remote index and STI models.

When the call to acts_as_ferret is processed in the base class, it is registered to the index, and then is available in the ferret server process as a valid Ruby class. When we try to use the subclass, however, it is not registered with the index (since acts_as_ferret is in the base class). The remote index call crashes like this:

NoMethodError: undefined method `[]' for #<DRb::DRbUnknown:0xb768f9cc>
    (druby://localhost:9009) /tmp/bli/vendor/plugins/acts_as_ferret/lib/local_index.rb:163:in `determine_stored_fields'
    (druby://localhost:9009) /tmp/bli/vendor/plugins/acts_as_ferret/lib/ferret_find_methods.rb:83:in `find_ids'
    (druby://localhost:9009) /tmp/bli/vendor/plugins/acts_as_ferret/lib/ferret_server.rb:139:in `send'
    (druby://localhost:9009) /tmp/bli/vendor/plugins/acts_as_ferret/lib/ferret_server.rb:139:in `method_missing'
    /tmp/bli/vendor/plugins/acts_as_ferret/lib/remote_index.rb:36:in `find_ids'
    /tmp/bli/vendor/plugins/acts_as_ferret/lib/remote_functions.rb:15:in `handle_drb_error'
    /tmp/bli/vendor/plugins/acts_as_ferret/lib/remote_index.rb:36:in `find_ids'
    /tmp/bli/vendor/plugins/acts_as_ferret/lib/ferret_find_methods.rb:69:in `find_id_model_arrays'
    /tmp/bli/vendor/plugins/acts_as_ferret/lib/ferret_find_methods.rb:27:in `ar_find'
    /tmp/bli/vendor/plugins/acts_as_ferret/lib/ferret_find_methods.rb:11:in `find_records'
    /tmp/bli/vendor/plugins/acts_as_ferret/lib/class_methods.rb:176:in `find_with_ferret'
    ./test/unit/employee_test.rb:7:in `test_find_with_ferret'
    /tmp/bli/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/testing/default.rb:7:in `run'

You'll find attached a small sample rails application with acts_as_ferret installed that shows the problem in its unit tests. To run these tests, first start the server:

./script/ferret_server -e test start

then run the unit tests:

rake test:units

please e-mail us if you need any further information regarding this: terceiro@colivre.coop.br and moises@colivre.coop.br

Attachments

bli.tar.gz (155.1 kB) - added by aaf on 06/19/08 21:40:26.
sample application exposing the problem
fix-acts_as_ferret-with-remote-index-and-STI.diff (0.6 kB) - added by aaf on 06/19/08 21:53:29.
register the class with the index. Makes STI models work with remote indexes

Change History

06/19/08 21:40:26 changed by aaf

  • attachment bli.tar.gz added.

sample application exposing the problem

06/19/08 21:41:50 changed by aaf

the attached tarball already includes sqlite databases, so it should run fine anywere. If not you'll have to rake db:migrate etc.

thanks

06/19/08 21:52:42 changed by aaf

the attached patch fixes the problem.

06/19/08 21:53:29 changed by aaf

  • attachment fix-acts_as_ferret-with-remote-index-and-STI.diff added.

register the class with the index. Makes STI models work with remote indexes

To edit pages or tickets please login with username/password: aaf/aaf