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.

30 lines
484 B

  1. class Follow < ActiveRecord::Base
  2. belongs_to :account
  3. belongs_to :target_account, class_name: 'Account'
  4. validates :account, :target_account, presence: true
  5. def verb
  6. :follow
  7. end
  8. def object_type
  9. :person
  10. end
  11. def target
  12. self.target_account
  13. end
  14. def content
  15. "#{self.account.acct} started following #{self.target_account.acct}"
  16. end
  17. def title
  18. content
  19. end
  20. after_create do
  21. self.account.stream_entries.create!(activity: self)
  22. end
  23. end