Remove complex methods from follow model. Create instance method followed_by? on followable model concern. Some code improvements.

This commit is contained in:
Senén Rodero Rodríguez
2017-07-19 21:50:37 +02:00
parent dec7d2d2b5
commit b7bce2e699
5 changed files with 16 additions and 31 deletions

View File

@@ -6,4 +6,8 @@ module Followable
has_many :followers, through: :follows, source: :user
end
def followed_by?(user)
followers.include?(user)
end
end