Skip to content
Snippets Groups Projects
Commit d6a3ba2e authored by Giovanne Marcelo's avatar Giovanne Marcelo
Browse files

Merge branch 'add-liked' into 'master'

add liked in collection serializer and collection min serializer

See merge request !341
parents 7789dc50 1fec9841
No related branches found
No related tags found
No related merge requests found
class CollectionMinSerializer < ActiveModel::Serializer class CollectionMinSerializer < ActiveModel::Serializer
cache key: 'collection', expires_in: 4.hours cache key: 'collection', expires_in: 4.hours, except: [:likes_count, :liked]
attributes :id, :name, :owner, :created_at, :updated_at, :description, :privacy, :score, :likes_count, :review_average, :thumbnail
def liked
object.liked? current_user
end
attributes :id, :name, :owner, :created_at, :updated_at, :description, :privacy, :score, :likes_count, :liked, :review_average, :thumbnail
has_many :tags has_many :tags
has_many :subjects has_many :subjects
has_many :educational_stages has_many :educational_stages
......
class CollectionSerializer < ActiveModel::Serializer class CollectionSerializer < ActiveModel::Serializer
cache key: 'collection', expires_in: 4.hours cache key: 'collection', expires_in: 4.hours, except: [:likes_count, :liked]
attributes :id, :name, :owner, :created_at, :updated_at, :description, :privacy, :score, :likes_count, :review_average, :thumbnail
def liked
object.liked? current_user
end
attributes :id, :name, :owner, :created_at, :updated_at, :description, :privacy, :score, :likes_count, :liked, :review_average, :thumbnail
has_many :tags has_many :tags
has_many :subjects has_many :subjects
has_many :educational_stages has_many :educational_stages
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment