Use transform_keys when possible
This commit is contained in:
parent
db8c3030e3
commit
5b62bc4f12
1 changed files with 4 additions and 4 deletions
|
@ -167,11 +167,11 @@ class Dossier < ActiveRecord::Base
|
|||
|
||||
def export_entreprise_data
|
||||
if entreprise.present?
|
||||
etablissement_attr = EtablissementCsvSerializer.new(self.etablissement).attributes.map { |k, v| ["etablissement.#{k}".parameterize.underscore.to_sym, v] }.to_h
|
||||
entreprise_attr = EntrepriseSerializer.new(self.entreprise).attributes.map { |k, v| ["entreprise.#{k}".parameterize.underscore.to_sym, v] }.to_h
|
||||
etablissement_attr = EtablissementCsvSerializer.new(self.etablissement).attributes.transform_keys { |k| "etablissement.#{k}".parameterize.underscore.to_sym }
|
||||
entreprise_attr = EntrepriseSerializer.new(self.entreprise).attributes.transform_keys { |k| "entreprise.#{k}".parameterize.underscore.to_sym }
|
||||
else
|
||||
etablissement_attr = EtablissementSerializer.new(Etablissement.new).attributes.map { |k, v| ["etablissement.#{k}".parameterize.underscore.to_sym, v] }.to_h
|
||||
entreprise_attr = EntrepriseSerializer.new(Entreprise.new).attributes.map { |k, v| ["entreprise.#{k}".parameterize.underscore.to_sym, v] }.to_h
|
||||
etablissement_attr = EtablissementSerializer.new(Etablissement.new).attributes.transform_keys { |k| "etablissement.#{k}".parameterize.underscore.to_sym }
|
||||
entreprise_attr = EntrepriseSerializer.new(Entreprise.new).attributes.transform_keys { |k| "entreprise.#{k}".parameterize.underscore.to_sym }
|
||||
end
|
||||
convert_specific_hash_values_to_string(etablissement_attr.merge(entreprise_attr))
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue