Workable draft prefill identity (no link or query help)
This commit is contained in:
parent
6198de1f43
commit
4cbb8e91f2
9 changed files with 169 additions and 79 deletions
|
@ -3,11 +3,12 @@
|
|||
module DossierPrefillableConcern
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def prefill!(champs_attributes)
|
||||
return unless champs_attributes.any?
|
||||
def prefill!(champs_attributes, identity_attributes)
|
||||
return if champs_attributes.empty? && identity_attributes.empty?
|
||||
|
||||
attributes = { prefilled: true }
|
||||
attributes[:champs_attributes] = champs_attributes.map { |h| h.merge(prefilled: true) }
|
||||
attributes[:individual_attributes] = identity_attributes
|
||||
|
||||
assign_attributes(attributes)
|
||||
save(validate: false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue