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
-
#activist ⇒ Object
Adds ActiveRecord associations to model to simplify fetching so you can list activities performed by the owner.
Instance Method Details
#activist ⇒ Object
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
24 25 26 27 28 29 30 31 32 |
# File 'lib/public_activity/orm/mongoid/activist.rb', line 24 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 |