diff --git a/app/controllers/new_administrateur/types_de_champ_controller.rb b/app/controllers/new_administrateur/types_de_champ_controller.rb index b88cb1642..ea7023757 100644 --- a/app/controllers/new_administrateur/types_de_champ_controller.rb +++ b/app/controllers/new_administrateur/types_de_champ_controller.rb @@ -44,7 +44,6 @@ module NewAdministrateur { type_de_champ: type_de_champ.as_json( except: [ - :id, :created_at, :options, :order_place, @@ -64,7 +63,7 @@ module NewAdministrateur :piece_justificative_template_url, :quartiers_prioritaires ] - ).merge(id: TypeDeChamp.format_stable_id(type_de_champ.stable_id)) + ) } end diff --git a/app/models/type_de_champ.rb b/app/models/type_de_champ.rb index e0ff6990d..fff12bd04 100644 --- a/app/models/type_de_champ.rb +++ b/app/models/type_de_champ.rb @@ -304,7 +304,7 @@ class TypeDeChamp < ApplicationRecord def read_attribute_for_serialization(name) if name == 'id' - self.class.format_stable_id(stable_id) + stable_id else super end @@ -317,15 +317,11 @@ class TypeDeChamp < ApplicationRecord # This is only needed for a clean migration without downtime. We want to ensure # that if editor send a simple id because it was loaded before deployment # we would still do the right thing. - def self.format_stable_id(stable_id) - "stable:#{stable_id}" - end - def self.to_stable_id(id_or_stable_id) if id_or_stable_id.to_s =~ /^stable:/ id_or_stable_id.to_s.gsub(/^stable:/, '') else - find(id_or_stable_id).stable_id + id_or_stable_id end end