Module: PublicActivity::ORM::Mongoid::Activist

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

Overview

Module extending classes that serve as owners

Instance Method Summary collapse

Instance Method Details

#activistObject

Adds ActiveRecord 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 < ActiveRecord::Base include PublicActivity::Model activist end

In controller: User.first.activities


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

def activist
  has_many :activities_as_owner,
    :class_name => "::PublicActivity::Activity",
    :inverse_of => :owner

  has_many :activities_as_recipient,
    :class_name => "::PublicActivity::Activity",
    :inverse_of => :recipient
end