Acts As Union plugin
Plugin details
Documentation
Install the plugin:
ruby script/plugin install git://github.com/mdi/acts_as_union.git
class Person < ActiveRecord::Base acts_as_network :friends acts_as_network :colleagues, :through => :invites, :foreign_key => 'person_id', :conditions => ["is_accepted = 't'"] acts_as_union :aquantainces, [:friends, :colleagues] end
In this case a call to the aquantainces method will return a UnionCollection on both a person’s friends and their colleagues. Likewise, finder operations will work accross the two distinct sets as if they were one.
Thus, for the following code
stephen = Person.find_by_name('Stephen') billy = stephen.aquantainces.find_by_name('Billy')
both Stephen’s friends and colleagues collections would be searched for someone named Billy.
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | (0 older versions) | Last edited by: hardway, 5 months ago

