demarches-normaliennes/app/serializers/operation_author_serializer.rb

19 lines
355 B
Ruby
Raw Normal View History

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 Administration
"Manager##{object.id}"
else
nil
end
end
end