lib/public_activity/orm/mongo_mapper/activist.rb
# 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
#
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.

In model.

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


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 . In model . class User include MongoMapper :: Document include PublicActivity :: Model activist end
def activist
          many :activities_as_owner,
            :class_name => "::PublicActivity::Activity",
            :as => :owner
          many :activities_as_recipient,
            :class_name => "::PublicActivity::Activity",
            :as => :recipient
        end
def activist many :activities_as_owner , :class_name => "::PublicActivity::Activity" , :as => :owner many :activities_as_recipient , :class_name => "::PublicActivity::Activity" , :as => :recipient end
Adds MongoMapper associations to model to simplify fetching
so you can list activities performed by the owner.
Adds MongoMapper associations to model to simplify fetching so you can list activities performed by the owner .