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.

27 lines
468 B

  1. class Favourite < ApplicationRecord
  2. include Paginable
  3. include Streamable
  4. belongs_to :account, inverse_of: :favourites
  5. belongs_to :status, inverse_of: :favourites, touch: true
  6. validates :status_id, uniqueness: { scope: :account_id }
  7. def verb
  8. :favorite
  9. end
  10. def title
  11. "#{account.acct} favourited a status by #{status.account.acct}"
  12. end
  13. delegate :object_type, to: :target
  14. def thread
  15. status
  16. end
  17. def target
  18. thread
  19. end
  20. end