Class: ActivityStream::Activity
- Inherits:
-
LogicalModel
- Object
- LogicalModel
- ActivityStream::Activity
- Defined in:
- app/models/activity_stream/activity.rb
Instance Attribute Summary collapse
-
#cached_object ⇒ Object
Returns the value of attribute cached_object.
-
#cached_target ⇒ Object
Returns the value of attribute cached_target.
Instance Method Summary collapse
- #json_root ⇒ Object
-
#local? ⇒ Boolean
Identifies activity as local to your app or not.
- #local_deleted_object? ⇒ Boolean
- #object ⇒ Object
- #target ⇒ Object
Instance Attribute Details
#cached_object ⇒ Object
Returns the value of attribute cached_object.
41 42 43 |
# File 'app/models/activity_stream/activity.rb', line 41 def cached_object @cached_object end |
#cached_target ⇒ Object
Returns the value of attribute cached_target.
54 55 56 |
# File 'app/models/activity_stream/activity.rb', line 54 def cached_target @cached_target end |
Instance Method Details
#json_root ⇒ Object
37 38 39 |
# File 'app/models/activity_stream/activity.rb', line 37 def json_root 'activity' end |
#local? ⇒ Boolean
Identifies activity as local to your app or not.
To identify your app you should define constant: ActivityStream::LOCAL_APP_NAME
33 34 35 |
# File 'app/models/activity_stream/activity.rb', line 33 def local? defined?(LOCAL_APP_NAME) && (generator == LOCAL_APP_NAME) end |
#local_deleted_object? ⇒ Boolean
50 51 52 |
# File 'app/models/activity_stream/activity.rb', line 50 def local_deleted_object? local? && object.nil? end |
#object ⇒ Object
42 43 44 45 46 47 48 |
# File 'app/models/activity_stream/activity.rb', line 42 def object if !cached_object.present? && local? klass = self.object_type.camelize.constantize self.cached_object = klass.find(object_id) if klass.exists?(object_id) end cached_object end |
#target ⇒ Object
55 56 57 58 59 60 61 |
# File 'app/models/activity_stream/activity.rb', line 55 def target if !cached_target.present? && local? klass = target_type.camelize.constantize self.cached_target = klass.find(target_id) if klass.exists?(target_id) end cached_target end |