Sha256: e42f70fee888dc4afcc5460a084e58de8b83d8016d2421c2a5cc4f0c15aa08b7

Contents?: true

Size: 541 Bytes

Versions: 7

Compression:

Stored size: 541 Bytes

Contents

class ActivityObject < ActiveRecord::Base
  @subtypes_name = :object
  include SocialStream::Models::Supertype

  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

7 entries across 7 versions & 1 rubygems

Version Path
social_stream-0.3.6 app/models/activity_object.rb
social_stream-0.3.5 app/models/activity_object.rb
social_stream-0.3.4 app/models/activity_object.rb
social_stream-0.3.3 app/models/activity_object.rb
social_stream-0.3.2 app/models/activity_object.rb
social_stream-0.3.1 app/models/activity_object.rb
social_stream-0.3.0 app/models/activity_object.rb