Class: ActivityObject
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ActivityObject
- Includes:
- SocialStream::Models::Supertype
- Defined in:
- app/models/activity_object.rb
Overview
The ActivityObject is any object that receives actions. Examples are creating post, liking a comment, contacting a user.
ActivityObject subtypes
All post, comment and user are objects. Social Stream privides 3 ActivityObject subtypes, Post, Comment and Actor. The application developer can define as many ActivityObject subtypes as required. Objects are added to config/initializers/social_stream.rb
Instance Method Summary collapse
-
#acts_as_actor? ⇒ Boolean
Does this ActivityObject has Actor?.
-
#author_subject ⇒ Object
The subject author.
-
#object ⇒ Object
The object of this activity object.
-
#owner_subject ⇒ Object
The subject owner.
-
#post_activity ⇒ Object
The activity in which this activity_object was created.
-
#user_author_subject ⇒ Object
The subject user actor.
Instance Method Details
#acts_as_actor? ⇒ Boolean
Does this ActivityObject has Actor?
61 62 63 |
# File 'app/models/activity_object.rb', line 61 def acts_as_actor? object_type == "Actor" end |
#author_subject ⇒ Object
The subject author
41 42 43 |
# File 'app/models/activity_object.rb', line 41 def .subject end |
#object ⇒ Object
The object of this activity object
34 35 36 37 38 |
# File 'app/models/activity_object.rb', line 34 def object subtype_instance.is_a?(Actor) ? subtype_instance.subject : subtype_instance end |
#owner_subject ⇒ Object
The subject owner
46 47 48 |
# File 'app/models/activity_object.rb', line 46 def owner_subject owner.subject end |
#post_activity ⇒ Object
The activity in which this activity_object was created
56 57 58 |
# File 'app/models/activity_object.rb', line 56 def post_activity activities.includes(:activity_verb).where('activity_verbs.name' => 'post').first end |
#user_author_subject ⇒ Object
The subject user actor
51 52 53 |
# File 'app/models/activity_object.rb', line 51 def .subject end |