perf(type-de-champ): replace stable_self OpenStruct by Struct model

This commit is contained in:
Colin Darie 2024-01-16 18:56:16 +01:00
parent fa74cdb4c7
commit e807752a78
No known key found for this signature in database
GPG key ID: 8C76CADD40253590
2 changed files with 5 additions and 2 deletions

View file

@ -0,0 +1 @@
KeyableModel = Struct.new(:model_name, :to_key, :param_key, keyword_init: true)

View file

@ -614,8 +614,10 @@ class TypeDeChamp < ApplicationRecord
end
def stable_self
OpenStruct.new(to_key: [stable_id],
model_name: OpenStruct.new(param_key: model_name.param_key))
KeyableModel.new(
to_key: [stable_id],
model_name: KeyableModel.new(param_key: model_name.param_key)
)
end
def refresh_after_update?