diff options
author | David Yip <yipdw@member.fsf.org> | 2017-11-17 17:58:13 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-17 17:58:13 -0600 |
commit | 284e2cde81811d6289dde9542f9c987062f9e7c2 (patch) | |
tree | 739fe0417fce9b9f48f924815b436a50b324dfe9 /app/models/list_account.rb | |
parent | 6f8ccbfcdf7fd8ca651d1583a608e96b25a09e25 (diff) | |
parent | 130aa90d5500f481c181a16012724b5f81d62616 (diff) |
Merge pull request #224 from yipdw/merge-upstream
Merge upstream (tootsuite/mastodon#5703)
Diffstat (limited to 'app/models/list_account.rb')
-rw-r--r-- | app/models/list_account.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/models/list_account.rb b/app/models/list_account.rb new file mode 100644 index 000000000..c08239aa0 --- /dev/null +++ b/app/models/list_account.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true +# == Schema Information +# +# Table name: list_accounts +# +# id :integer not null, primary key +# list_id :integer not null +# account_id :integer not null +# follow_id :integer not null +# + +class ListAccount < ApplicationRecord + belongs_to :list, required: true + belongs_to :account, required: true + belongs_to :follow, required: true + + before_validation :set_follow + + private + + def set_follow + self.follow = Follow.find_by(account_id: list.account_id, target_account_id: account.id) + end +end |