Module: SocialStream::Models::ActivityObject::InstanceMethods

Defined in:
lib/social_stream/models/activity_object.rb

Instance Method Summary collapse

Instance Method Details

#_activity_tieObject



47
48
49
# File 'lib/social_stream/models/activity_object.rb', line 47

def _activity_tie
  @_activity_tie ||= Tie.find(_activity_tie_id)
end

#activitiesObject

All the activities with this object



29
30
31
32
33
# File 'lib/social_stream/models/activity_object.rb', line 29

def activities
  Activity.
    includes(:activity_objects => self.class.to_s.underscore).
    where("#{ self.class.quoted_table_name }.id" => self.id)
end

#create_activity_object_with_type(attributes = {}) ⇒ Object

Create corresponding ActivityObject including this class type



43
44
45
# File 'lib/social_stream/models/activity_object.rb', line 43

def create_activity_object_with_type(attributes = {}) #:nodoc:
  create_activity_object_without_type attributes.update(:object_type => self.class.to_s)
end

#post_activityObject

The activity in which this object was posted

FIXME: Currently it only supports direct objects



38
39
40
# File 'lib/social_stream/models/activity_object.rb', line 38

def post_activity
  (activities.includes(:activity_verb) & ActivityVerb.verb_name('post')).first
end