about summary refs log tree commit diff
path: root/app/models/follow.rb
blob: 2032159470507a0aef671f8a0e067fd074f58a71 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class Follow < ActiveRecord::Base
  belongs_to :account
  belongs_to :target_account, class_name: 'Account'

  validates :account, :target_account, presence: true

  def verb
    :follow
  end

  def object_type
    :person
  end

  def target
    self.target_account
  end

  def content
    "#{self.account.acct} started following #{self.target_account.acct}"
  end

  def title
    content
  end

  after_create do
    self.account.stream_entries.create!(activity: self)
  end
end