You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
562 B

  1. class StreamEntry < ActiveRecord::Base
  2. belongs_to :account, inverse_of: :stream_entries
  3. belongs_to :activity, polymorphic: true
  4. def object_type
  5. case self.activity_type
  6. when 'Status'
  7. :note
  8. when 'Follow'
  9. :person
  10. end
  11. end
  12. def verb
  13. case self.activity_type
  14. when 'Status'
  15. :post
  16. when 'Follow'
  17. :follow
  18. end
  19. end
  20. def target
  21. case self.activity_type
  22. when 'Follow'
  23. self.activity.target_account
  24. end
  25. end
  26. def content
  27. self.activity.text if self.activity_type == 'Status'
  28. end
  29. end