Module | MuckActivity::InstanceMethods |
In: |
lib/muck_activities.rb
|
add_activity adds an activity to all activites feeds that belong to the objects found in feed_to.
an item but instead might have a message or other text.
# File lib/muck_activities.rb, line 47 47: def add_activity(feed_to, source, item, template, title = '', content = '', check_method = nil) 48: feed_to = [feed_to] unless feed_to.is_a?(Array) 49: activity = Activity.create(:item => item, :source => source, :template => template, :title => title, :content => content) 50: feed_to.each do |ft| 51: if check_method 52: ft.activities << activity if ft.send(check_method) 53: else 54: ft.activities << activity 55: end 56: end 57: end
# File lib/muck_activities.rb, line 65 65: def can_view?(check_object) 66: self == check_object 67: end
status returns the first activity item from the user‘s activity feed that is a status update. Used for displaying the last status update the user made
# File lib/muck_activities.rb, line 61 61: def status 62: self.activities.find(:first, :conditions => ['is_status_update = true'], :order => 'created_at DESC') 63: end