Partial Class Definition if Ferret Server Not Running

When using a remote ferret server, if the ferret server is not running
the acts_as_ferret class method will raise an exception. This causes
the model class to only be partially defined, and therefore all use of
that class in the rails application will explode until the rails process
is restarted.

This stems from the fact that ensure_index_exists is called on the
server just before the end of the acts_as_ferret class method. This
brings up a few questions:

  1. Why can’t remote_index call ensure_index_exists on the fly similar to
    how local_index does it? Can’t this be done in the server on the fly?
    What about rebuilding all indexes in the server using
    ensure_index_exists at start up time, instead of being called for each
    class during class definition?

  2. There seems to be a lot of generic functionality in local_index that
    could be moved up to the abstract index, and therefor expand the
    functionality of the remote_index class. Are there any reasons this
    hasn’t been done yet?

Either way, this needs to be corrected because allowing an exception to
raise during class definition is a very bad thing. I’d be more than
happy to submit a patch if someone points me in the right direction
regarding the correct way to resolve this (in remote_index or

Having the ferret_server check the indexes when it starts seems to be
the correct idea, instead of having them checked once for each class in
each rails process as it starts.