review: prefer if to unless

Co-authored-by: LeSim <mail@simon.lehericey.net>
This commit is contained in:
Sébastien Carceles 2022-12-05 09:32:00 +01:00 committed by sebastiencarceles
parent 006a1257b5
commit 9dfb498806

View file

@ -4,7 +4,7 @@ module DossierPrefillableConcern
extend ActiveSupport::Concern
def prefill!(champs_public_attributes)
return unless champs_public_attributes.any?
return if champs_public_attributes.empty?
assign_attributes(champs_public_attributes: champs_public_attributes.map { |h| h.merge(prefilled: true) })
save(validate: false)