Newer
Older
Mauricio Giacomini Girardello
committed
class LearningObjectSerializer < ActiveModel::Serializer
cache key: 'learning_object', expires_in: 4.hours, except: [:likes_count, :liked, :reviewed, :complained]
object.default_attachment.try(:mime_type)
end
def default_attachment_id
object.default_attachment.try(:id)
def thumbnail
object.default_thumbnail
end
def object_type
object.object_type.try(:name)
end
object.liked? current_user
end
attributes :id,
:name,
:description,
:author,
:thumbnail,
:publisher,
:object_type,
:language,
:default_attachment_id,
:default_mime_type,
:score,
:link,
:software,
:shares_count,
:created_at,
:updated_at
has_many :subjects
has_many :educational_stages