improve relations and scopes
This commit is contained in:
@@ -9,4 +9,9 @@ class User < ApplicationRecord
|
||||
}
|
||||
|
||||
has_many :posts
|
||||
|
||||
has_many :user_follows_following, class_name: 'UserFollow', foreign_key: :follower_id
|
||||
has_many :user_follows_followers, class_name: 'UserFollow', foreign_key: :followed_id
|
||||
has_many :following, through: :user_follows_following, source: :followed
|
||||
has_many :followers, through: :user_follows_followers, source: :follower
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user