[Fix #1865] Expose attachment field over API

This commit is contained in:
Frederic Merizen 2018-04-24 20:27:19 +02:00
parent fe0aafdd44
commit 5b9f25271f
3 changed files with 34 additions and 0 deletions

View file

@ -1,5 +1,15 @@
class ChampSerializer < ActiveModel::Serializer
include Rails.application.routes.url_helpers
attributes :value
has_one :type_de_champ
def value
if object.piece_justificative_file.attached?
url_for(object.piece_justificative_file)
else
object.value
end
end
end