2022-11-28 15:54:14 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-12-01 09:37:00 +01:00
|
|
|
module DossierPrefillableConcern
|
2022-11-28 15:54:14 +01:00
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
def prefill!(champs_public_attributes)
|
2022-12-05 09:32:00 +01:00
|
|
|
return if champs_public_attributes.empty?
|
2022-11-28 15:54:14 +01:00
|
|
|
|
2022-12-01 12:00:21 +01:00
|
|
|
assign_attributes(champs_public_attributes: champs_public_attributes.map { |h| h.merge(prefilled: true) })
|
2022-11-28 15:54:14 +01:00
|
|
|
save(validate: false)
|
|
|
|
end
|
|
|
|
end
|