public
Description: Presents a union'ed view of one or more ActiveRecord relationships.
Homepage:
Clone URL: git://github.com/mdi/acts_as_union.git
name age message
file LICENSE Loading commit data...
file README.textile
file init.rb
directory lib/

Extracted from acts_as_network.

acts_as_union simply presents a union’ed view of one or more ActiveRecord
relationships (has_many or has_and_belongs_to_many, acts_as_network, etc).

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.

acts_as_union doesn’t accept any options.