2018-02-09 17:38:30 +01:00
|
|
|
class ChampSerializer < ActiveModel::Serializer
|
2018-04-24 20:27:19 +02:00
|
|
|
include Rails.application.routes.url_helpers
|
|
|
|
|
2018-02-09 17:38:30 +01:00
|
|
|
attributes :value
|
|
|
|
|
|
|
|
has_one :type_de_champ
|
2018-04-24 20:27:19 +02:00
|
|
|
|
|
|
|
def value
|
|
|
|
if object.piece_justificative_file.attached?
|
|
|
|
url_for(object.piece_justificative_file)
|
|
|
|
else
|
|
|
|
object.value
|
|
|
|
end
|
|
|
|
end
|
2018-02-09 17:38:30 +01:00
|
|
|
end
|