This is HyperactiveRecord, a not-at-all drop-in replacement for ActiveRecord::Base

It uses archipelago for persistence, and is meaningful only in an environment where the server process doesnt restart at each request. This means that cgi environment is not really an option.

Sub packages:

Hyperactive::Record

The base class package itself, providing you with cached selectors and rejectors, along with cached finders for any number of attributes.

Hyperactive::Hash

A collection class that contains any number of Hyperactive::Records in a hash like structure.

Hyperactive::List

A collection class that contains any number of Hyperactive::Records in a list like structure.

Hyperactive::Index

A module included into Hyperactive::Record that adds simple indexing capabilities of the find_by_… type.

Hyperactive::Transactions

A module included into Hyperactive::Record that adds a few simplifications in handling transactions properly.

Hyperactive::Hooker

A module that provides around-hook functinality to Hyperactive::Record, so that you can implement save, destroy, create and load hooks that wrap the actual event.

Usage:

To use Hyperactive in the simplest way, just run the script/services.rb script from the Archipelago distribution to get a few services running, then subclass Hyperactive::Record::Bass and create objects with MyBassSubclass.get_instance. They will be automagically stored in the network, and fetchable via their instance.record_id.

You can also use new of course, but beware that this will not store the object persistently or give you a proxy. Both of these things are good for you, so use get_instance unless you know what you are doing.

Examples:

To define a Record subclass that has the properties @active and @city that are indexed in two ways:

class MyClass < Hyperactive::Record:Bass
  attr_accessor :active, :city
  select :active_records do |record|
  			      record.active == true
                          end
  index_by :city
end

This will allow you to find all active MyClass instances by:

MyClass.active_records

Or finding all MyClass instances connected to Stockholm by:

MyClass.find_by_city("Stockholm")