Module: MuckActivity::ActMethods

Defined in:
lib/muck_activity.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_activity_sourceObject

acts_as_activity_source gives the class it is called on a method called add_activity that can add activities into a feed.



24
25
26
27
28
# File 'lib/muck_activity.rb', line 24

def acts_as_activity_source
  unless included_modules.include? InstanceMethods
    include InstanceMethods
  end
end

#has_activitiesObject

has_activities gives the class it is called on an activity feed and a method called add_activity that can add activities into a feed. Retrieve activity feed items via object.activities. ie @user.activities.



14
15
16
17
18
19
20
# File 'lib/muck_activity.rb', line 14

def has_activities
  unless included_modules.include? InstanceMethods
    has_many :activity_feeds, :as => :ownable
    has_many :activities, :through => :activity_feeds, :order => 'created_at desc'
    include InstanceMethods
  end
end