#5 Remove duplicated method from user serializer

This commit is contained in:
2015-10-25 18:05:39 +08:00
parent c6828a01ab
commit a837aecf9c
+2 -6
View File
@@ -1,6 +1,6 @@
class UserSerializer < ActiveModel::Serializer
attributes :id, :name, :email, :avatar, :followed, :posts_count, :likes_count, :stars_count, :follows_count,
attributes :id, :name, :email, :avatar, :followed, :posts_count, :likes_count, :follows_count,
:followers_count,
def followed
@@ -16,12 +16,8 @@ class UserSerializer < ActiveModel::Serializer
object.likes.count
end
def stars_count
object.stars.count
end
def follows_count
FollowRelation.where(user_id: object.id).count
object.stars.count
end
def followers_count