Module: SocialStream::Models::Object::InstanceMethods
- Defined in:
- lib/social_stream/models/object.rb
Instance Method Summary collapse
- #_activity_parent ⇒ Object
- #_contact ⇒ Object
-
#activities ⇒ Object
All the activities with this object.
-
#build_post_activity ⇒ Object
Build the post activity when this object is not saved.
-
#create_activity_object_with_type ⇒ Object
Build corresponding ActivityObject including this class type.
-
#post_activity ⇒ Object
The activity in which this object was posted.
Instance Method Details
#_activity_parent ⇒ Object
64 65 66 |
# File 'lib/social_stream/models/object.rb', line 64 def _activity_parent @_activity_parent ||= Activity.find(_activity_parent_id) end |
#_contact ⇒ Object
60 61 62 |
# File 'lib/social_stream/models/object.rb', line 60 def _contact @_contact ||= Contact.find(_contact_id) end |
#activities ⇒ Object
All the activities with this object
32 33 34 35 36 |
# File 'lib/social_stream/models/object.rb', line 32 def activities Activity. includes(:activity_objects => self.class.to_s.underscore). where("#{ self.class.quoted_table_name }.id" => self.id) end |
#build_post_activity ⇒ Object
Build the post activity when this object is not saved
46 47 48 49 |
# File 'lib/social_stream/models/object.rb', line 46 def build_post_activity Activity.new :contact_id => _contact_id, :relation_ids => Array(_relation_ids) end |
#create_activity_object_with_type ⇒ Object
Build corresponding ActivityObject including this class type
54 55 56 57 58 |
# File 'lib/social_stream/models/object.rb', line 54 def create_activity_object_with_type #:nodoc: o = create_activity_object! :object_type => self.class.to_s # WEIRD: Rails 3.1.0.rc3 does not assign activity_object_id self.activity_object_id = o.id end |
#post_activity ⇒ Object
The activity in which this object was posted
FIXME: Currently it only supports direct objects
41 42 43 |
# File 'lib/social_stream/models/object.rb', line 41 def post_activity (activities.includes(:activity_verb) & ActivityVerb.verb_name('post')).first end |