demarches-normaliennes/app/serializers/operation_author_serializer.rb
2020-11-05 16:03:55 +01:00

18 lines
351 B
Ruby

class OperationAuthorSerializer < ActiveModel::Serializer
attributes :id, :email
def id
case object
when User
"Usager##{object.id}"
when Instructeur
"Instructeur##{object.id}"
when Administrateur
"Administrateur##{object.id}"
when SuperAdmin
"Manager##{object.id}"
else
nil
end
end
end