Module: PublicActivity::ORM::MongoMapper::Activist

Defined in:
lib/public_activity/orm/mongo_mapper/activist.rb

Overview

Module extending classes that serve as owners

Instance Method Summary collapse

Instance Method Details

#activistObject

Adds MongoMapper associations to model to simplify fetching so you can list activities performed by the owner. It is completely optional. Any model can be an owner to an activity even without being an explicit activist.

== Usage: In model:

class User include MongoMapper::Document include PublicActivity::Model activist end

In controller: User.first.activities


23
24
25
26
27
28
29
30
# File 'lib/public_activity/orm/mongo_mapper/activist.rb', line 23

def activist
  many :activities_as_owner,
    :class_name => "::PublicActivity::Activity",
    :as => :owner
  many :activities_as_recipient,
    :class_name => "::PublicActivity::Activity",
    :as => :recipient
end