Sha256: b63c406f7b9a969c7657f7413d625173ec469f8dc48ebe29feab5987d5bacae2

Contents?: true

Size: 1.01 KB

Versions: 16

Compression:

Stored size: 1.01 KB

Contents

# 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 {SocialStream::Models::Object 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+
#
class ActivityObject < ActiveRecord::Base
  @subtypes_name = :object
  include SocialStream::Models::Supertype

  acts_as_taggable
  
  has_many :activity_object_activities, :dependent => :destroy
  has_many :activities, :through => :activity_object_activities
  has_one  :actor

  # The object of this activity object
  def object
    subtype_instance ||
      actor.try(:subject)
  end

  # The activity in which this activity_object was created
  def post_activity
    activities.includes(:activity_verb).where('activity_verbs.name' => 'post').first
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
social_stream-base-0.7.2 app/models/activity_object.rb
social_stream-base-0.7.1 app/models/activity_object.rb
social_stream-base-0.7.0 app/models/activity_object.rb
social_stream-base-0.6.8 app/models/activity_object.rb
social_stream-base-0.6.6 app/models/activity_object.rb
social_stream-base-0.6.5 app/models/activity_object.rb
social_stream-base-0.6.3 app/models/activity_object.rb
social_stream-base-0.6.2 app/models/activity_object.rb
social_stream-base-0.6.1 app/models/activity_object.rb
social_stream-base-0.6.0 app/models/activity_object.rb
social_stream-base-0.5.2 app/models/activity_object.rb
social_stream-base-0.5.1 app/models/activity_object.rb
social_stream-base-0.5.0 app/models/activity_object.rb
social_stream-0.4.6 app/models/activity_object.rb
social_stream-0.4.5 app/models/activity_object.rb
social_stream-0.4.4 app/models/activity_object.rb