[Fix #1865] Expose attachment field over API
This commit is contained in:
parent
fe0aafdd44
commit
5b9f25271f
3 changed files with 34 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue